Compare commits

...

470 Commits

Author SHA1 Message Date
Brian Paul
7d3af894d6 docs: point to fd.o for downloads instead of SourceForge 2009-09-03 15:44:49 -06:00
Brian Paul
32156f3a11 gallium/xlib: silence unitialized var warning 2009-09-03 15:44:22 -06:00
Brian Paul
1c32caf075 gallium/xlib: silence uninitialized var warning 2009-09-03 15:23:15 -06:00
Brian Paul
67c286d20e st/mesa: silence uninitialized var warnings 2009-09-03 15:04:49 -06:00
Brian Paul
0b4e835b13 docs: prep for 7.5.1 release 2009-09-03 14:57:30 -06:00
Brian Paul
08575509e4 docs: added news entry for 7.5.1 2009-09-03 14:57:16 -06:00
Brian Paul
ccb081414b docs: update precompiled libs info 2009-09-03 14:57:04 -06:00
Brian Paul
47df7900fd docs: move SGI GLU link 2009-09-03 14:56:50 -06:00
Brian Paul
c3a0624ef0 st/mesa: fix glCopyPixels(GL_STENCIL_INDEX) inverted position
If the renderbuffer orientation is Y=0=TOP we need to invert the dstY
position.
2009-09-03 14:39:53 -06:00
Keith Whitwell
e79054cc40 st/mesa: Do GL_RGBA->GL_RGB texsubimage on hardware
State tracker currently backs GL_RGB textures with RGBA almost always.
This means we need to maintain A==1 in these textures to give correct GL_RGB
sampling results.

This change offloads the RGBA->RGB copy to hardware using the new writemask
version of u_blit_pixels.

More src/dstLogical/dstActual triples could be shifted to hardware by
this technique in future patches.
2009-09-02 18:31:48 +01:00
Keith Whitwell
de343680a3 util: add version of u_blit_pixels which takes a writemask
Values outside the writemask are set in the destination to {0,0,0,1}
2009-09-02 18:31:48 +01:00
Keith Whitwell
1d7a989b10 draw: remove unused variable 2009-09-02 18:31:47 +01:00
Brian Paul
d9b7d7875b progs/tests: re-enable exit() call
See bug 21267.
2009-09-01 08:53:34 -06:00
Brian Paul
3f785080db swrast: fix selection/feedback regression
This fixes a conform selection/feedback regression introduced by commit
8f4d66c5f8
2009-08-31 17:54:46 -06:00
Brian Paul
fcf0804c05 swrast: can't use deferred texture/shading if using KIL instruction
If the fragment program uses KIL, we have to execute it before z/stencil
testing.  Otherwise, deferred texture/shading lets us skip shading for
pixels that fail z/stencil testing.
2009-08-31 13:28:31 -06:00
Brian Paul
9f36473a8e mesa: added const qualifiers, move local var 2009-08-31 11:17:59 -06:00
Brian Paul
2241665dc6 mesa: fix saturation logic in emit_texenv()
We need to clamp/saturate after each texenv stage, not just the last one.
Fixes glean texEnv failure for softpipe (and probably other fragment program-
based drivers).
2009-08-31 11:14:16 -06:00
Brian Paul
6bf86681f5 docs: fixed glXCreateGLXPixmap() for direct rendering 2009-08-31 10:32:56 -06:00
Brian Paul
f7654faf16 docs/: document cross-compile fix 2009-08-31 10:32:14 -06:00
Marc Dietrich
a48ee529a2 mesa: fix 32bit cross compilation on a 64bit machine
When cross compiling on a 64bit machine, gen_matypes.c is build
for the host machine (64bit) but must generates code for the target
machine (32bit). This causes wrong offsets all over the place and
crashes googleearth on my machine. Solution is to add -m32 when
cross compiling.

Attached patch is compatible with linux-x86-32 and autoconf based
builds.
2009-08-31 10:32:14 -06:00
Michel Dänzer
edb1178798 glx/x11: Fix glXCreateGLXPixmap for direct rendering.
Fixes progs/xdemos/glxpixmap modified to use direct rendering.
2009-08-30 12:53:00 +02:00
José Fonseca
9399b9a0e2 util: Reset size to zero when failed to allocate buffer. 2009-08-28 12:52:31 +01:00
Brian Paul
0d7bed9f89 docs: fix selection/feedback culling bug 2009-08-27 16:50:44 -06:00
Brian Paul
8f4d66c5f8 swrast: fix incorrect tri culling in selection/feedback mode.
See bug 16866.
2009-08-27 16:50:03 -06:00
marvin24
43a064e06d mesa: direct program debug output to stderr instead of stdout 2009-08-27 09:22:51 -06:00
Brian Paul
32f95f8c17 gallium/util: added support for SRGB formats
Fixes glean/texture_srgb failure, bug #23449.
2009-08-27 09:10:38 -06:00
Brian Paul
f8ae968d28 gallium/util: added cases for SRGB formats 2009-08-27 09:09:56 -06:00
Brian Paul
babb5ba9a9 glsl: signal that the program needs to be re-translated when samplers change 2009-08-26 14:29:50 -06:00
Brian Paul
d09d03aa42 docs: document sampler array bug fix 2009-08-26 12:04:35 -06:00
Brian Paul
488b3c4d1b progs/glsl: add special Makefile rule for samplers_array 2009-08-26 11:55:15 -06:00
Brian Paul
f6d34c2058 progs/glsl: change samplers.c to better test sampler/texture indexing
Now the left half is yellow and the right half is red, with the gradients
going in opposite directions.
2009-08-26 11:53:25 -06:00
Brian Paul
04d170794a glsl: fix bug in sampler array indexing
Need to add the 'offset' parameter when indexing the parameter array.
Before, if we were setting arrays of samplers, we were actually only
setting the 0th sampler's value.

Because of how progs/glsl/samplers.c is constructed, this wasn't showing
up as a failure in the samplers_array output.
2009-08-26 11:39:31 -06:00
Brian Paul
bf7e4b10cb ARB prog: Set error instead of falling through with incorrect value
If a fragment program only parameter was queried of a vertex program
(e.g., GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB) no error would be set and
a random value would be returned.  This caused 'glxinfo -l' to show
the same values for GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB,
GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB as for
GL_MAX_PROGRAM_ENV_PARAMETERS_ARB.  This is confusing and incorrect.

(cherry picked from master, commit 4bccd693a7)
2009-08-24 13:56:01 -06:00
Brian Paul
96f7b42242 docs: recent 7.5.1 bug fixes 2009-08-24 13:02:33 -06:00
Brian Paul
b5ecbbe636 xlib: fix single buffer window resize bug
When a single-buffered window was resized the new window size was never
detected.  This fix that, but there's still a bug which causes window
contents corruption for certain window sizes...
2009-08-24 12:58:49 -06:00
Brian Paul
b9b04872d5 vbo: fix divide by zero exception
Fixes bug 23489.
2009-08-24 12:44:00 -06:00
Vinson Lee
f785b35b47 glsl: Silence gcc uninitialized variable warning. 2009-08-24 11:43:02 -06:00
Brian Paul
1aba1baa62 st/mesa: flush bitmap cache if Z value changes
When adding a new bitmap to the cache we have to check if the Z value is
changing and flush first if it is.

This is a modified version of a patch from Justin Dou <justin.dou@intel.com>
2009-08-21 10:24:50 -06:00
Brian Paul
ce723d8d8b tgsi: check for SOA dependencies in SSE and PPC code generators
Fall back to interpreter for now.  This doesn't happen very often.
2009-08-20 10:34:45 -06:00
Brian Paul
4c7c294fff tgsi: handle SOA dependencies for MOV/SWZ
SOA dependencies can happen when a register is used both as a source and
destination and the source is swizzled.  For example:

MOV T, T.yxwz; would expand into:

  MOV t0, t1;
  MOV t1, t0;
  MOV t2, t3;
  MOV t3, t2;

The second instruction will produce the wrong result since we wrote to t0
in the first instruction.  We need to use an intermediate temporary to fix
this.

This will take more work to fix for all TGSI instructions.  This seems to
happen with MOV instructions more than anything else so fix that case now
and warn on others.

Fixes piglit glsl-vs-loop test (when not using SSE). See bug 23317.
2009-08-20 10:28:22 -06:00
Brian Paul
5e6d21afa4 tgsi: added tgsi_full_instruction::Flags field
Users of the parser can make use of this.
2009-08-20 10:25:55 -06:00
Brian Paul
3097d7dbf8 tgsi/ppc: we don't implement saturation modes yet 2009-08-18 17:50:52 -06:00
Brian Paul
fab17c1216 tgsi/sse: we don't implement saturation modes yet
Fixes piglit fp-generic tests/shaders/generic/lrp_sat.fp, bug 23316.
2009-08-18 17:50:00 -06:00
Brian Paul
ee0984e299 mesa: when emitting vertex program fog, set yzw=0,0,1
Fixes piglit fp-fog failure with gallium.
2009-08-18 17:39:55 -06:00
Brian Paul
e8957f4800 progs/demos: print more info in fbotexture.c 2009-08-14 17:30:32 -06:00
José Fonseca
e3bc1fb6bc gallium: Always map for READ flag when DISCARD is not set.
This prevents the driver from discarding a buffer when the whole buffer
is mapped for writing, but only a portion is effectively written.

This is a temporary fix, because WRITE shouldn't imply DISCARD.

The full fix implies using PIPE_BUFFER_USAGE_DISCARD, throughout
the code, and will go only into master.
2009-08-14 20:05:51 +01:00
José Fonseca
10430f47a4 trace: Remove space next to the class attribute of the trace. 2009-08-14 20:05:51 +01:00
José Fonseca
cdf56eb68d python/retrace: Open bz2 files correctly. 2009-08-14 20:05:51 +01:00
Brian Paul
1574b05189 docs: docs: document new --with-max-width/height config options 2009-08-14 11:24:20 -06:00
Brian Paul
a7ca80ff6a Add a FAQ about internal buffer sizes.
(cherry picked from master, commit 9a8781bd24)
2009-08-14 11:23:18 -06:00
Brian Paul
467b3d9a6f Add configure options for MAX_WIDTH/HEIGHT.
This adds two --with configure options for setting defines for
MAX_WIDTH and MAX_HEIGHT.  It's conceivably just as easy to define
these in CFLAGS manually, but this way users don't need to know
about internal Mesa details.

Patch updated by BrianP to set DEFINES, not CFLAGS.

(cherry picked from master, commit 7085dce750)
2009-08-14 11:23:00 -06:00
Brian Paul
e691b0e533 Allow external settings of MAX_WIDTH/HEIGHT.
Conditionalize MAX_WIDTH / MAX_HEIGHT defines so that users can
set them via CFLAGS.

(cherry picked from master, commit 66bc17e80e)
2009-08-14 11:22:37 -06:00
Brian Paul
3ffaa11f88 mesa: move assertions in test_attachment_completeness()
Put the assertions after the error checks.
2009-08-14 10:30:10 -06:00
Brian Paul
1e0f621b50 mesa: fix some invalid memory reads
We were passing the address of a float to functions that would deref the
pointer as an array.
2009-08-13 14:38:27 -06:00
Brian Paul
6d55fd705d progs/tests: hack a PBO/dlist test 2009-08-13 14:07:25 -06:00
Brian Paul
ecb177eaea mesa: fix warnings about locals hiding function params 2009-08-13 14:05:52 -06:00
Brian Paul
36df6a6e91 mesa: add missing PBO mapping code in unpack_image() 2009-08-13 14:00:21 -06:00
Brian Paul
ad8a6937ae main: fix some potential memory leaks
Allocate dlist images after error checking.
Record GL_OUT_OF_MEMORY when we can't make a copy of an image.
2009-08-13 13:48:36 -06:00
Brian Paul
f418d18ea6 mesa: fix some potential uninitialized memory references 2009-08-13 13:44:31 -06:00
Brian Paul
a531a5cf94 glsl: fix some uninitialized pointers 2009-08-13 13:44:01 -06:00
Keith Whitwell
1ce3f5a806 draw: cope with more primitives in draw_pipeline_run
This previously was used only for decomposed (POINT/LINE/TRI) primitives,
but for some time a full range of primitives could end up in here.

Fixes trivial/lineloop-clip on softpipe, among others.
(cherry picked from commit 87cd8a3b8a2407b30916be418ff2f95dfea5d2ad)
2009-08-13 15:56:17 +01:00
Pauli Nieminen
d80b36f64f dri: Fix problems with unitialized values in dri screen object.
This fixes crash in r200 KMS driver when pSAREA was set to 1 randomly because of memory wasn't cleared.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-07 11:24:47 -06:00
Brian Paul
9676ed27fe util: fix incorrect assertion
Check that the dest surface/format is renderable.
2009-08-06 14:58:06 -06:00
Brian Paul
98f00e8eb9 util: include u_surface.h, added comment 2009-08-06 14:54:25 -06:00
Brian Paul
24fdf8aadb util: use util_same_surface() to compare surface pointers 2009-08-06 09:47:13 -06:00
Brian Paul
ffb1f9bded util: added util_same_surface() helper function 2009-08-06 09:47:13 -06:00
Alan Hourihane
8c223e8eb6 Ensure GL_EXT_blend_equation_separate is enabled when 2.0 is enabled. 2009-08-06 16:16:55 +01:00
Brian Paul
5b3428d745 docs:fix glBlitFramebuffer() for Gallium 2009-08-05 13:50:21 -06:00
Brian Paul
a59579c983 st/mesa: implement BlitFramebuffer() for depth/stencil (incomplete)
We now handle the case of blitting Z+stencil to/from combined Z/stencil
surfaces.  But Z-only or stencil-only and separate depth/stencil surfaces
are not yet implemented.
2009-08-05 13:46:47 -06:00
Brian Paul
dcebe220f4 mesa: generate GL_INVALID_OPERATION for missing z/stencil when blitting
If glBlitFramebuffer() is called with GL_DEPTH_BUFFER_BIT or
GL_STENCIL_BUFFER_BIT and the src/dst depth/stencil buffers are absent,
report an error.
2009-08-05 13:44:59 -06:00
Brian Paul
f792137593 st/mesa: fix Y inversion and optimize st_BlitFramebuffer()
Need to check for Y inversion separately for src/dest buffers.

If both the src and dest regions are upside down, make them right-side
up for a better chance at a fast path.

progs/tests/copypixrate -blit is much faster now.
2009-08-05 13:26:19 -06:00
Brian Paul
2cd33afa00 util: added comment/question about blit clipping 2009-08-05 13:22:26 -06:00
Brian Paul
727b2d747e mesa: make _mesa_clip_blit() a shared function 2009-08-05 13:21:59 -06:00
Brian Paul
4f36164024 util: added util_blit_pixels() overlap test
A comment alluded to this.  Now it's checked.
2009-08-05 13:19:03 -06:00
Brian Paul
05d393f59f util: fix util_blit_pixels() test for surface_copy() path
For the surface_copy() path require same format, no flipping and no stretching.

Fixes progs/tests/copypixrate -blit
2009-08-05 13:09:15 -06:00
Brian Paul
854ea483d4 util: reformatting and comments 2009-08-05 13:08:19 -06:00
Brian Paul
3a221a9018 docs: 7.5.1 bug fixes 2009-08-04 09:27:49 -06:00
Brian Paul
61673aebb0 intel: Fix inverted test for disabling flushing of front buffer output.
The comment disagreed with the code, and nicely drew my eyes to what was
going wrong.

Bug #21774 (blender)
Bug #21788 (readpix)

(cherry picked from master, commit fd65418f60)
2009-08-04 09:23:17 -06:00
Brian Paul
f5f8be8bb2 intel: Wait on the last swapbuffers to complete before queuing a new one.
This fixes jerkiness in doom3 and other apps since the kernel change to
throttle less absurdly, which led to a thundering herd of frames.

Because this is a rather minimal fix, there is at least one downside: If
the whole scene completes in one batchbuffer, we'll end up stalling the GPU.

Thanks to Michel Dänzer for suggesting using glFlush to signal frame end
instead of going to all the effort of adding a new DRI2 extension.

(cherry picked from master, commit 0828579a65)
2009-08-04 09:22:15 -06:00
Brian Paul
2bec909c69 texenv: Use VP->Current, since _Current isn't updated at this point.
(cherry picked from master, commit a9ba1bfeb3)
2009-08-04 09:15:33 -06:00
Brian Paul
f0df08abbe texenv: Match state.c in deciding whether we'll be using a vertex shader.
(cherry picked from master, commit 40990d9dfb)
2009-08-04 09:15:09 -06:00
Brian Paul
9d3929b60c texenv: Add missing dependency on VP changes.
Funny thing is I annotated this dependency in
e5f63c403b, but didn't actually use it.

(cherry picked from master, commit 03187571b6)

Conflicts:
	src/mesa/main/state.c
2009-08-04 09:14:33 -06:00
Dan Nicholson
9185a61c8a mklib: Ensure target directory exists for library
Instead of relying on the Makefile to always generate $(TOP)/$(LIB_DIR),
just have mklib handle creating the directory. This should fix any races
when using parallel make.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
(cherry picked from commit 23671e5358)
2009-08-04 06:30:46 -07:00
Peter Hutterer
0ce73f84e9 Add missing X11_INCLUDES to egl/drivers/demo and egl/main.
Compiling mesa on a system with no X headers installed in the default
include paths fails due to missing X11 includes. The header includes are
picked up by configure but not applied.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 5358e54d1a)
2009-08-04 06:30:30 -07:00
Pauli Nieminen
fb7cf731f9 xdemo/glxswapcontrol: Move get_framge_usage after the swap.
This fixes the problem that first frame would report bogus usage values.
Problem was caused because get_frame_usage returned data from previous buffer
swap.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-03 13:42:05 -06:00
Pauli Nieminen
b59eb3b8b1 xdemos/glxcontexts: Don't leak visual info when choosing visual again.
Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2009-08-03 11:55:29 -06:00
Brian Paul
ed6125fe9b st/mesa: we don't support GL_NV_point_sprite (see comment) 2009-08-03 11:16:23 -06:00
Brian Paul
35e3449ad7 mesa: move misplaced return statement
Fixes regression from commit 7d93f817c9
2009-07-30 09:02:36 -06:00
Brian Paul
7d93f817c9 mesa: add missing return after catching program error 2009-07-30 08:23:26 -06:00
Keith Whitwell
6842829539 mesa/st: short-circuit glFinish calls on WIN32 only
Windows opengl32.dll calls glFinish prior to every swapbuffers, which
makes it pretty hard to get decent performance...

Work around by mapping finish to flush on PIPE_OS_WINDOWS.  This is
conformant, though it might confuse poorly-written benchmarks which
attempt to measure a single event rather than figuring out the rate of
continuous processing.
2009-07-29 12:48:05 +01:00
Keith Whitwell
2420b283b7 mesa/st: recognize no-op scissor state when checking clear_with_quads
Some apps enable scissor but set the rectangle to the dimensions of
the window.  Don't let this force us onto a slower clear path.
2009-07-29 12:48:04 +01:00
Keith Whitwell
4d99e14535 util: _debug_printf should print even when DEBUG is not defined
The leading underscore is meaningful...  This function is used by
_warning and _error functions as well as the more common
debug_printf().

debug_printf (without underscore) gets turned off when DEBUG is
disabled, but warning/error messages still use this function to get
their message out.
(cherry picked from commit 0ac879dca7)
2009-07-29 12:48:04 +01:00
RALOVICH, Kristóf
45f4e8842e glx: assign per screen driver configs (DRISW) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
d090ba9e00 glx: assign per screen driver configs (DRI) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
82f4dc21cc glx: assign per screen driver configs (DRI2) 2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
e32b601e7d glx: properly release DRI configs
Release per screen DRI driver configs during screen destruction.
2009-07-28 10:35:56 -06:00
RALOVICH, Kristóf
ce0ad53281 glx: cache DRI configs in __GLXscreenConfigsRec 2009-07-28 10:35:56 -06:00
Vinson Lee
bc60b88411 progs/trivial: add missing files to Makefile, .gitignore 2009-07-28 08:54:48 -06:00
Brian Paul
3dbaf68bdc intel: Fix leak of DRI option info due to using the wrong free routine.
(cherry picked from commit 6d66f23c50)
2009-07-27 15:33:07 -06:00
Brian Paul
722d136f7b intel: Clean up leak of driver context structure on context destroy.
(cherry picked from commit ddef7dc87b)
2009-07-27 15:33:07 -06:00
Brian Paul
a7427b0f7b st/mesa: silence warning 2009-07-27 15:10:28 -06:00
Brian Paul
0ad9eba333 mesa: separate some finite/pragma Watcom stuff 2009-07-27 15:10:00 -06:00
Brian Paul
7e2f26cbbf softpipe: include sp_winsys.h to silence function prototype warning 2009-07-27 15:08:44 -06:00
Brian Paul
d2f56fe687 intel: Use _mesa_warning() to report GEM warnings 2009-07-27 14:35:18 -06:00
Karl Schultz
09ef339b69 windows: updated VC8 project files
See bug 22882.
2009-07-27 13:38:35 -06:00
Brian Paul
25e371fb7b docs: 7.5 tarball md5sums 2009-07-27 13:27:54 -06:00
José Fonseca
5276b049b4 util: fix typo. 2009-07-26 20:31:59 +01:00
Brian Paul
c57d81ddc9 mesa: include glew headers in MesaDemos tarballs 2009-07-23 20:20:39 -06:00
Brian Paul
b4ba6a66b7 docs: initial release notes for 7.5.1 2009-07-22 12:49:34 -06:00
Brian Paul
9c4b877519 mesa: bump version to 7.5.1 2009-07-22 12:46:53 -06:00
Brian Paul
b9e2e32daf mesa: include GLEW sources in MesaDemos tarball 2009-07-22 12:34:07 -06:00
Eric Anholt
a6b314150c intel: Fall back on glBitmap with fog enabled.
We would have to build the program with the appropriate fog mode, and
also supply the fog coordinate if appropriate.

Bug #19413.
(cherry picked from commit 8ae02a3919)
2009-07-20 19:10:32 -07:00
Eric Anholt
1b445f9673 i965: Don't clip everything if FRONT_AND_BACK culling while culling disabled.
Fixes everything-black with meta_clear_tris on quake4-mpdemo and doom3-demo.

Bug #18844, 22077.
(cherry picked from commit 81d5550684)
2009-07-20 19:10:20 -07:00
Michel Dänzer
5ed4404005 radeon: With DRI1, if we have HW stencil, only expose fbconfigs with stencil.
Otherwise simple apps like glxgears pick up a DirectColor visual since the X
server mixes the depth 32 visual in with the other GLX visuals, and this seems
to result in a (mostly) black screen due to a bad ColorMap for a lot of people.

The bad ColorMap may be a bug in the apps, the X server or X driver, and
regardless of that I think the X server should ideally make the depth 32 GLX
visual separate from the rest again, but in the meantime this makes us cope.

(depth_bits is either 16 or 24, never 0)
2009-07-20 20:34:04 +02:00
Brian Paul
cd10996d4f progs/util: remove extfuncs.h (we use GLEW instead) 2009-07-17 14:43:29 -06:00
Brian Paul
ee0b1bc7d3 progs/glsl: finish conversion to GLEW
This is a follow-on to b799af91d5.
Remove _func function suffix and unneeded #includes.
2009-07-17 13:23:11 -06:00
Brian Paul
a77b455af0 mesa: set version to 7.5 2009-07-17 12:40:48 -06:00
Brian Paul
71b9e10291 mesa: set version to 7.5 2009-07-17 12:40:44 -06:00
Brian Paul
7fd3674672 docs: set date for 7.5 release 2009-07-17 12:40:24 -06:00
Brian Paul
27587f46e5 docs: news entry for 7.5 release 2009-07-17 09:40:59 -06:00
Brian Paul
8c6e81f97d docs: update links to Gallium wiki page on freedesktop.org 2009-07-17 09:40:59 -06:00
José Fonseca
2ba98efdf6 python/retrace: Process the call no passed to --to option inclusively. 2009-07-16 19:34:44 +01:00
José Fonseca
cf7e8fbc2e python/retrace: Dump the surface copy contents. 2009-07-16 19:32:40 +01:00
José Fonseca
5807ccb41b python/retrace: Flush stdout before calling the pipe driver.
So that messages are in sync with stderr.
2009-07-16 19:31:36 +01:00
José Fonseca
d4e6df9ab6 mesa: Fix logbase2.
It was providing 1 too many for non power two values.
2009-07-16 19:20:25 +01:00
José Fonseca
0c4350790a python: Hack to prevent segmentation faults when python exits. 2009-07-16 11:22:56 +01:00
José Fonseca
4e1e18a772 wgl: Expose pipe_screen/pipe_context via an extension. 2009-07-16 11:22:56 +01:00
José Fonseca
3ab3209a1f python: Obtain pipe_screen/pipe_context from the system's OpenGL driver. 2009-07-16 11:22:56 +01:00
Luca Barbieri
6b7b13b5eb softpipe: limit blend results to [0,1] 2009-07-15 11:34:36 -06:00
Brian Paul
d970313b66 Fix state flag dependencies for fixed function fragment program updates.
I started looking into why _NEW_ARRAY punishes us, and while annotating
dependencies noticed that a bunch of dependencies were missing.

(cherry picked from master, commit e5f63c403b)
2009-07-15 11:12:44 -06:00
José Fonseca
0474b5cb2a python/retrace: Interpret surface_copy. 2009-07-15 16:02:39 +01:00
José Fonseca
c68f659be3 python/samples: Use PIPE_FORMAT_Z16_UNORM instead of PIPE_FORMAT_Z32_UNORM.
More common. True fix would be to use whatever the screen supports though.
2009-07-15 16:02:39 +01:00
Keith Whitwell
fdeb778990 mesa: recognize and eliminate repeated error messages 2009-07-15 13:31:51 +01:00
Keith Whitwell
59de430de7 mesa: split out errorstring switch from _mesa_error
Move a chunk of code out of _mesa_error()
2009-07-15 13:31:51 +01:00
Keith Whitwell
df5f7a6761 mesa: remove dead code in _mesa_error
Remove early and unused snprintf and where[] string.
2009-07-15 13:31:51 +01:00
Keith Whitwell
6c9d8a6f24 mesa: don't call getenv every time _mesa_error is called
Buggy apps can generate thousands of mesa_error calls.  Don't need
to keep calling getenv to retreive the same MESA_DEBUG string each
time.
2009-07-15 13:31:50 +01:00
Brian Paul
9aca6769df mesa: fix texture border color code for glPopAttrib()
The texture object's border color used to be stored as GLchan but it's
been GLfloat for a while now.
2009-07-14 14:28:01 -06:00
Jakob Bornecrantz
26e58a42b0 progs/tests: Use compressed texture in mipmap_comp_tests 2009-07-14 17:11:07 +01:00
Jakob Bornecrantz
b0a17581e2 progs/tests: Tests more views in mipmap_comp_tests 2009-07-14 17:11:05 +01:00
Jakob Bornecrantz
a36b9987cd progs/tests: Add yet another mipmap test 2009-07-14 17:11:01 +01:00
Brian Paul
6ec955efaf mesa: regenerated enums.c file 2009-07-14 07:58:43 -06:00
José Fonseca
7325c1ebc8 scons: Monkey patch os.spawnve on Windows to become thread safe.
See also:
- http://bugs.python.org/issue6476
- http://scons.tigris.org/issues/show_bug.cgi?id=2449
2009-07-14 12:21:25 +01:00
José Fonseca
4ed1de8b84 mesa: Report the true face number when flushing. 2009-07-14 12:20:43 +01:00
Peteri Andras
680f7d09b0 r128: fix two-sided lighting segfault seen in GLUT's olight demo 2009-07-13 08:04:08 -06:00
Ian Romanick
022e8e582e intel: Bump driver data, add RC3 tag 2009-07-12 21:07:38 -07:00
Zack Rusin
1c1307e7c5 gallium: compare the actual register, not all the inputs
otherwise we decrement indexes for all registers
2009-07-11 13:48:41 -04:00
Brian Paul
cff2126f52 tgsi: update some assertions 2009-07-10 16:26:09 -06:00
Brian Paul
a79586ce18 tgsi: tgsi: add semantic_names[] string for TGSI_SEMANTIC_FACE
Same story as in the tgsi_dump.c code (see prev commit).
2009-07-10 15:44:48 -06:00
Brian Paul
f01af4dbd2 tgsi: add semantic_names[] string for TGSI_SEMANTIC_FACE
Fixes TGSI dump output when front/back-face register is declared.

Also, add some assertions to make sure the semantic/interpolate string
arrays have as many elements as there are tokens in the p_shader_tokens.h
file.  That should catch problems like this in the future.
2009-07-10 15:41:26 -06:00
Brian Paul
762c1d11ff st/mesa: implement indirect addressing for destination registers 2009-07-10 13:09:09 -06:00
Brian Paul
baa7ff47d5 tgis: implement indirect addressing for destination registers
Includes the TGSI interpreter, but not the SSE/PPC/etc code generators.
2009-07-10 13:09:09 -06:00
Brian Paul
ca1b71b78d vbo: fix vbo/dlist memory leak
Based on a patch by kristof.ralovich@gmail.com
2009-07-10 13:09:09 -06:00
Brian Paul
6ff1a5385e demos: set 4th component of texcoord to 1.0
Avoid potential randomness in resulting texcoords.
2009-07-10 13:09:09 -06:00
Michel Dänzer
cade071d52 Remove stale reference to non-Gallium nouveau driver from configure.ac. 2009-07-10 14:49:46 +02:00
Ian Romanick
fcd3572edf mesa: From float type modifier from values to large for singles
The values 2147483648.0 and 4294967294.0 are too larget to be stored in single
precision floats.  Forcing these to be singles causes bits to be lost, which
results in errors in some pixel transfer tests.

This fixes bug #22344.
(cherry picked from commit 70e72070fc)
2009-07-09 16:07:05 -07:00
Brian Paul
78af70be37 docs: document gl_TextureMatrix[i][j] array indexing bug fix 2009-07-09 08:04:07 -06:00
Brian Paul
c86b076668 glsl: do const parameter optimization for array element actual parameters
When a function parameter is const-qualified we can avoid making a copy
of the actual parameter (we basically do a search/replace when inlining).
This is now done for array element params too, resulting in better code
(fewer MOV instructions).

We should allow some other types of function arguments here but let's be
conservative for the moment.
2009-07-09 07:58:50 -06:00
Brian Paul
abdb0fdcc0 glsl: fix incorrect indexing for gl_TextureMatrix[i][j]
The two indexes were mixed up when accessing a row of a matrix in an array
of matrices.
2009-07-09 07:57:29 -06:00
Brian Paul
36e906aad6 docs: document glMaterial/glShadeModel display list optimization 2009-07-08 14:14:03 -06:00
Brian Paul
4adc9b4a5b mesa: only use fallback texture when using shaders, not fixed-function (take two)
The semantics are a little different for shaders vs. fixed-function when
trying to use an incomplete texture.  The fallback texture returning
(0,0,0,1) should only be used with shaders.  For fixed function, the texture
unit is truly disabled/ignored.

Fixes glean fbo test regression.
(cherry picked from commit 01e16befd4)
(cherry picked from commit 51325f44d1)
[anholt: squashed these two together from master, skipping the mess in between]
2009-07-07 16:02:45 -07:00
Zack Rusin
7b861b9b9e gallium: fixup register indexes for fog/frontface/point coord 2009-07-07 12:48:50 -07:00
Michel Dänzer
71633abafc gallium: Fixes for clobbering stencil values in combined depth/stencil textures.
Also fix one case where a 32 bit depth value was incorrectly converted to a
combined depth/stencil value.
2009-07-07 14:49:52 +02:00
Michel Dänzer
25b492b976 GLX/DRI1: Mark GLX visuals with depth != screen depth non-conformant.
Such visuals are subject to automatic compositing in the X server, so DRI1
can't render to them properly.
2009-07-07 13:59:59 +02:00
Michel Dänzer
96601ec8e0 gallium: Only set FRONT_STATUS_COPY_OF_BACK if there is a back buffer.
Fixes potential crash when SwapBuffers is called but there's no back buffer.
2009-07-07 12:17:04 +02:00
Zack Rusin
a4d952358d gallium: more fog extraction fixes
fix the cases when fog coord/front face/point coord are used in the same
shader.
2009-07-06 21:35:15 -04:00
Ian Romanick
7fb4becf98 demos: Fix vsync checking in glxgears
Of course glXGetVideoSyncSGI doesn't return the swap interval.  The feature
only exists in the Mesa extension... which is the whole reason I created the
Mesa extension!  Note that the Mesa extension allows drivers to default to a
swap interval of 0.  If the Mesa extension exists, use its value.  Only
consider the SGI extension when the Mesa extension is not available.

Fixes bug #22604.
2009-07-06 11:42:12 -07:00
José Fonseca
1068c15c61 wgl: Make the stw_framebuffer destructions threadsafe.
Ensure no other thread is accessing a framebuffer when it is being destroyed by
acquiring both the global and per-framebuffer mutexes. Normal access only
needs the global lock to walk the linked list and acquire the per-framebuffer
mutex.
2009-07-06 18:23:37 +01:00
José Fonseca
6f4167c8a2 wgl: Check for multiple threads before GET_CURRENT_CONTEXT.
Fixes wglthreads -- the 2nd thread MakeCurrent call was trying to flush
the first thread context while still in use.
2009-07-06 17:40:08 +01:00
José Fonseca
5470a67335 wgl: Listen to WM_WINDOWPOSCHANGED instead of WM_SIZE messages.
According to
http://blogs.msdn.com/oldnewthing/archive/2008/01/15/7113860.aspx
WM_SIZE is generated from WM_WINDOWPOSCHANGED by DefWindowProc so it
can be masked out by the application.

Also there were some weird bogus WM_SIZE 0x0 messages when starting
sharedtex_mt which we don't get like this.
2009-07-06 17:08:37 +01:00
Roland Scheidegger
fc6e02ce62 i965: fix fetching constants from constant buffer in glsl path
the driver used to overwrite grf0 then use implicit move by send instruction
to move contents of grf0 to mrf1. However, we must not overwrite grf0 since
it's still used later for fb write.
Instead, do the move directly do mrf1 (we could use implicit move from another
grf reg to mrf1 but since we need a mov to encode the data anyway it doesn't
seem to make sense).
I think the dp_READ/WRITE_16 functions may suffer from the same issue.
While here also remove unnecessary msg_reg_nr parameter from the dataport
functions since always message register 1 is used.
2009-07-04 15:35:07 +02:00
Eric Anholt
c30f23c123 i965: Remove bad constant buffer constant-reg-already-loaded optimization.
Thanks to branching, the state of c->current_const[i].index at the point
of emitting constant loads for this instruction may not match the actual
constant currently loaded in the reg at runtime.  Fixes a regression in my
GLSL program for idr's class since b58b3a786a.
2009-07-04 15:32:56 +02:00
Michel Dänzer
94e1117c9b intel: Also update stencil bits in intel_update_wrapper().
Fixes assertion failure when binding depth/stencil texture to FBO stencil
attachment.
2009-07-03 17:54:34 +02:00
Keith Whitwell
f580494bef progs: revert damage to progs/SConscript from recent compressed texture commit 2009-07-03 16:40:03 +01:00
Keith Whitwell
b928d18398 mesa/shaders: fix gl_NormalMatrix state parameters
gl_NormalMatrix is the inverse transpose of the modelview matrix, but
as every matrix here needs to be transposed, we end up with
{MODELVIEW_MATRIX, INVERSE}.
2009-07-03 14:31:07 +01:00
Keith Whitwell
aa98575ebb st/wgl: don't advertise WGL_EXT_swap_interval string
This is a tweak to a previous fix -- it's not necessary to actually
advertise this extension to prevent these games from crashing -- they
ignore the extension string anyway. It's sufficient to just have
GetProcAddress return some dummy function addresses for SwapInterval.

Given we don't really implement this funcitonality, this is a better
fix.
2009-07-03 14:31:06 +01:00
José Fonseca
cffe7c8bd0 wgl: Lookup framebuffers by HWND whenever possible.
Some applications create several HDCs for the same window, so spite the WGL
API is geared towards HDCs it is not reliable searching by HDC.
2009-07-03 14:21:55 +01:00
José Fonseca
2a2236606f mesa: Assume depth textures have a single level unless told otherwise. 2009-07-02 17:24:50 +01:00
Keith Whitwell
588c862571 mesa: s/TRUE/GL_TRUE
Fix compile breakage on Linux.
2009-07-02 14:44:06 +01:00
Keith Whitwell
798cd2a98d glapi: ensure _mesa_lookup_prim_by_nr() is not clobbered on regeneration
Propogate changes to enums.c back up to the python source.
2009-07-02 13:33:20 +01:00
Keith Whitwell
1668a679c4 Merge commit 'origin/dlist-statechange-shortcircuit' into mesa_7_5_branch
Conflicts:
	progs/trivial/Makefile

Pull in a minimal version of statechange shortcircuiting in display
list compilation.  This affects only glMaterial and glShadeModel state,
and includes quite a few tests to exercise various tricky cases.

If this goes well, will consider extending to all state in the future.
2009-07-02 13:29:46 +01:00
Keith Whitwell
b3e8e1cd4c mesa: ensure UsesFogFragCoord value is set for non-glsl shaders
With recent changes to support frontfacing in glsl, it is necessary
to ensure that the UsesFogFragCoord value is accurate in all shaders.
We were previously not setting it for fixed-function and ARB_fs shaders.
2009-07-02 11:28:56 +01:00
Keith Whitwell
1fa4cde757 mesa/vbo: fix compile and replay of nodes ending in a FALLBACK
Where vbo save nodes are terminated with a call to DO_FALLBACK(), as in
the case of a recursive CallList which is itself within a Begin/End pair,
there two problems:
1) The display list node's primitive information was incorrect, stating
the cut-off prim had zero vertices
2) On replay, we would get confused by a primitive that started in a
node, but was terminated by individual opcodes.

This change fixes the first problem by correctly terminating the last
primitive on fallback, and the second by forcing the display list to
use the Loopback path, converting all nodes into immediate-mode rendering.

The loopback fix is a performance hit, but avoiding this would require
a fairly large rework of this code.
2009-06-30 19:52:44 +01:00
Keith Whitwell
70ae7ba818 mesa/dlist: fixes and improvements for material caching
Only short-circuit material call if *all* statechanges from this call
are cached.  Some material calls (eg with FRONT_AND_BACK) change more
than one piece of state -- need to check all of them before returning.

Also, Material calls are legal inside begin/end pairs, so don't need
to be as careful about begin/end state as with regular statechanges
(like ShadeModel) when caching.  Take advantage of this and do better
caching.
2009-06-30 18:40:20 +01:00
Keith Whitwell
c48c01c9e7 progs/trivial: add dlist-mat-tri.c 2009-06-30 18:37:34 +01:00
Keith Whitwell
1ca836f0de progs/trivial: add test case for short-circuiting material changes
Similar to dlist-tri-flat-tri, but using glMaterial calls, which
have the extra property of being legal within Begin/End calls.
2009-06-30 18:17:39 +01:00
Keith Whitwell
d6c2347d79 mesa/dlist: don't cache state which may not be replayed on CallList
Statechanges which occur before the first End in a display list may
not be replayed when the list is called, in particular if it is called
from within a begin/end pair.

Recognize vulnerable statechanges and do not use them to fill in the
state cache.
2009-06-30 17:10:56 +01:00
Keith Whitwell
09a3a28fc8 progs/trivial: add dlist-flat-tri.c
State-change functions which precede the first call to glEnd() in
a compiled list are vulnerable to not being executed when that list
is called.

In particular this can happen if a list is invoked from within a
begin/end pair, as in this example.
2009-06-30 17:06:50 +01:00
Keith Whitwell
7e91d035b9 mesa/dlist: invalidate cached dlist compile state after CallList
When compiling a display list containing a CallList, it is necessary to
invalidate any assumption about the GL state after the recursive call
completes.
2009-06-30 17:04:11 +01:00
Keith Whitwell
2e570be852 progs/trivial: add dlist-recursive-call
When one display list calls another display list, it is possible
that the calling display list makes state-changes or other actions which
invalidate any attempt at caching or state-change elimination in the
calling list.

This test exercises one such case, where the called list consists of just
a single glShadeModel() call.
2009-06-30 17:02:16 +01:00
Keith Whitwell
1730eaa2a2 dlist-tri-flat-tri: make tri render differently if flatshade not enabled
When testing flat-shading, it helps to specify per-vertex colors so
that you can distinguish between flat & smooth shading.
2009-06-30 16:57:21 +01:00
Keith Whitwell
4147bb24d4 Merge branch 'mesa_7_5_branch' into dlist-statechange-shortcircuit
Need this to pick up fixes for per-vertex materials.
2009-06-30 16:28:54 +01:00
Keith Whitwell
6af783bea0 progs/trivial: add test case for lighting plus per-vertex materials
Exercise material-within-begin/end case.
2009-06-30 16:19:23 +01:00
Keith Whitwell
a9ae89d104 progs/isosurf: add materials mode for glVertex + TRISTRIP 2009-06-30 16:14:08 +01:00
Keith Whitwell
6dfb89e4a0 mesa: remove whitespace 2009-06-30 16:14:05 +01:00
Keith Whitwell
cea259f039 mesa: remove dead constant pointsize code from ffvertex_prog.c 2009-06-30 16:13:58 +01:00
Keith Whitwell
79047cc1dd mesa: remove dead vertex fog code from ffvertex_prog.c 2009-06-30 16:13:53 +01:00
Keith Whitwell
f6c8ca06f6 mesa: fix material inputs in ffvertex_prog.c
Varying material inputs were not being picked up from the same slots
where the VBO code is currently placing them (GENERIC0 and above).
Most often they were just being ignored.
2009-06-30 16:13:22 +01:00
Arthur HUILLET
4c31632817 mesa: fix transform_points_3d_no_rot using undefined values in %xmm0
Signed-off-by: Arthur HUILLET <arthur.huillet@free.fr>
2009-06-30 08:43:23 -06:00
Kristof Ralovich
fa5b0364f9 glx: plug a leak
Swrast was missing a free for the culmination of driConcatConfigs.

Use free(), not _mesa_free() since we shouldn't be calling any Mesa
functions from the GLX code.  driConcatConfigs() should probably use
regular malloc/free to be consistant but the Mesa functions just wrap
the libc functions anyway.
2009-06-30 08:43:22 -06:00
Brian Paul
52f895df51 glx: fix null pointer dereference segfault (bug 22546) 2009-06-30 08:43:22 -06:00
Keith Whitwell
14a2b5445a progs/util: make sure function pointers are initialized
Call Init() from CompileShaderFile, was previously only called for the
Text version of this function.
2009-06-30 15:41:43 +01:00
José Fonseca
6e09c1fd08 mesa: Set FLUSH_EXPLICIT_BIT flags when calling FlushMappedBufferRange.
As prescribed by ARB_map_buffer_range.
2009-06-30 15:33:53 +01:00
José Fonseca
18a6f0f1a7 util: Set PIPE_BUFFER_USAGE_FLUSH_EXPLICIT when calling buffer_flush_mapped_range. 2009-06-30 15:33:53 +01:00
José Fonseca
4ffe2844a4 gallium: New PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flag for buffer_flush_mapped_range.
When a buffer was mapped for write and no explicit flush range was provided
the existing semantics were that the whole buffer would be flushed, mostly
for backwards compatability with non map-buffer-range aware code.

However if the buffer was mapped/unmapped with nothing really written --
something that often happens with the vbo -- we were unnecessarily assuming
that the whole buffer was written.

The new PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flag (based from ARB_map_buffer_range
's GL_MAP_FLUSH_EXPLICIT_BIT flag) allows to clearly distinguish the
legacy usage from the nothing written usage.
2009-06-30 15:33:53 +01:00
Jakob Bornecrantz
578230dbbf st/gl: Add stubs for CompressedTexSubImage[1D|3D] 2009-06-30 14:11:49 +02:00
Jakob Bornecrantz
a4fd94a54a st/gl: Add support for glCompressedTexSubImage 2009-06-30 14:11:45 +02:00
Jakob Bornecrantz
ba7f45ac0c progs/tests: Add tests for glCompressedTexSubImage 2009-06-30 14:11:29 +02:00
José Fonseca
f2de2d5f37 util: Increase OutputDebugStringA to 4k.
According to http://unixwiz.net/techtips/outputdebugstring.html that's
how big the buffer is.

The 512bytes limitation is in kernel mode.
2009-07-01 19:10:50 +01:00
José Fonseca
e2a8ef4430 mesa: Unbind depth/stencil surface from pipe_framebuffer when none is attached. 2009-07-01 19:10:49 +01:00
Keith Whitwell
6c913411d3 st/wgl: dummy implementation of wgl swapinterval extension
Required as some applications
retrieve and call these functions regardless of the fact that we
don't advertise the extension and further more the results of
wglGetProcAddress are NULL.
2009-07-01 17:37:15 +01:00
Zack Rusin
1c04731b87 gallium: fix the front face semantics
mesa allocates both frontface and pointcoord registers within the fog
coordinate register, by using swizzling. to make it cleaner and easier
for drivers we want each of them in its own register. so when doing
compilation from the mesa IR to tgsi allocate new registers for both
and add new semantics to the respective declarations.
2009-07-01 10:45:55 -04:00
José Fonseca
e8c4663c11 wgl: Optimize wglGetProcAddress.
Do linear search only if prefix matches.
2009-07-01 10:03:59 +01:00
Eric Anholt
c72261f2a8 i915: Fix assertion failure on remapping a non-BO-backed VBO.
Failure to set the obj->Pointer back to null tripped up the assertion.
Bug #22428.
(cherry picked from commit 57a06d3a48)
2009-06-30 13:29:37 -07:00
Jon TURNEY
57955451f8 xdemos: Fix xdemos which default to using display :0.0 to default to $DISPLAY
Fix xdemos which default to using display :0.0 to default to $DISPLAY,
this is kind of irritating when testing on a display other than :0.0

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-06-30 13:58:21 -06:00
Keith Whitwell
e5cb11adda mesa/vbo: fix compile and replay of nodes ending in a FALLBACK
Where vbo save nodes are terminated with a call to DO_FALLBACK(), as in
the case of a recursive CallList which is itself within a Begin/End pair,
there two problems:
1) The display list node's primitive information was incorrect, stating
the cut-off prim had zero vertices
2) On replay, we would get confused by a primitive that started in a
node, but was terminated by individual opcodes.

This change fixes the first problem by correctly terminating the last
primitive on fallback, and the second by forcing the display list to
use the Loopback path, converting all nodes into immediate-mode rendering.

The loopback fix is a performance hit, but avoiding this would require
a fairly large rework of this code.
2009-06-30 19:59:38 +01:00
Keith Whitwell
53f8dccd0c progs/trivial: test case for dlist statechange elimination
Creates a display list with redundant call to glShadeModel.

View dlist contents with MESA_VERBOSE=list
2009-06-30 12:20:24 +01:00
Keith Whitwell
00438bb94a mesa/dlist: restore missing SAVE_FLUSH_VERTICES in save_ShadeModel
Reorganization of ShadeModel to avoid flushing vertices too often
ended up never flushing vertices due to omitted line of code.
2009-06-30 12:19:11 +01:00
Keith Whitwell
0846c88ec3 mesa/vbo: use _lookup_prim_by_nr for debugging
Switch over to specialized enum lookup for primitives
2009-06-30 12:16:41 +01:00
Keith Whitwell
aa688d1579 mesa: add debug printer for primitive name
Add a simple version of _mesa_lookup_enum_by_nr() which expects a primitive
enum (GL_POINTS..GL_POLYGON).  This avoids some annoying duplicates
when looking up primitives, such as the GL_FALSE/GL_POINTS clash.
2009-06-30 12:13:59 +01:00
Brian Paul
8d24160a40 progs/glsl: link with GLEW library
(cherry picked from commit b1f2f92d9b)
2009-06-30 11:47:51 +01:00
Keith Whitwell
47173cf67f mesa/dlist: shortcircuit some redundant statechanges at compile time
Currently, state-changes in mesa display lists are more or less
a verbatim recording of the GL calls made during compilation.

This change introduces a minor optimization to recognize and eliminate
cases where the application emits redundant state changes, eg:

  glShadeModel( GL_FLAT );
  glBegin( prim )
  ...
  glEnd()
  glShadeModel( GL_FLAT );
  glBegin( prim )
  ...
  glEnd()

The big win is when we can eliminate all the statechanges between two
primitive blocks and combine them into a single VBO node.

This commit implements state-change elimination for Material and ShadeModel
only.  This is enough to make a start on debugging, etc.
2009-06-30 09:55:33 +01:00
Brian Paul
4e43126a59 intel: added null ptr check
This fixes a segfault seen with piglit's fdo20701 test.
2009-06-29 15:26:28 -06:00
Brian Paul
b1f2f92d9b progs/glsl: link with GLEW library 2009-06-29 10:32:04 -06:00
Keith Whitwell
9014f475ff progs/util: make sure function pointers are initialized
Call Init() from CompileShaderFile, was previously only called for the
Text version of this function.
2009-06-29 16:07:14 +01:00
Keith Whitwell
b799af91d5 progs/glsl: compile with scons and glew
Get most of these working with scons.
2009-06-29 14:15:08 +01:00
José Fonseca
9a5ee12434 scons: Don't raise an exception when DXSDK is not found.
Unfortunately scons does not check if a tool exists before it invokes
its generate function.
2009-06-29 12:56:47 +01:00
José Fonseca
bb8f3090ba scons: Disable optimizations only for gcc-4.2
gcc-4.2's optimizer has a strange bug where it looses code from inner
loops in certain situations. For example, if the appearently innocent
looking code below is compiled with gcc-4.2 -S -O1, the inner loop's
code is missing from the outputed assembly.

   struct Size {
      unsigned width;
   };

   struct Command {
      unsigned length;
      struct Size sizes[32];
   };

   extern void emit_command(void *command, unsigned length);

   void
   create_surface( struct Size size, unsigned faces, unsigned levels)
   {
      struct Command cmd;
      unsigned face;
      unsigned level;

      cmd.length = faces*levels*sizeof(cmd.sizes[0]);

      for(face = 0; face < faces; ++face) {
	 for(level = 0; level < levels; ++level) {
	    cmd.sizes[face*levels + level] = size;
	    // This should generate a shrl statement, but the whole for body
	    // disappears in gcc-4.2 -O1/-O2/-O3!
	    size.width >>= 1;
	 }
      }

      emit(&cmd, sizeof cmd.length + cmd.length);
   }

Note that this is not specific to MinGW's gcc-4.2 crosscompiler (the
version typically found in debian/ubuntu's mingw32 packages). gcc-4.2 on
Linux also displays the same error. gcc-4.3 and above gets this
correctly though.

Updated MinGW debian packages with gcc-4.3 are available from
http://people.freedesktop.org/~jrfonseca/debian/pool/main/m/
2009-06-28 11:12:22 +01:00
José Fonseca
72ad039d19 scons: Use -Bsymbolic linker option.
This prevents the error

  relocation R_X86_64_PC32 against symbol `_gl_DispatchTSD' can not be used when making a shared object; recompile with -fPIC

when building on x86_64 architecture.
2009-06-28 10:54:23 +01:00
Brian Paul
418987ff05 docs: detect when too many varying vars are used 2009-06-26 16:54:44 -06:00
Brian Paul
21320b24c5 glsl: check number of varying variables against the limit
Link fails if too many varying vars.

(cherry picked from master, commit cc58fbcf2c)
2009-06-26 16:53:46 -06:00
Brian Paul
4181a107cb docs: fix typos, remove old text from relnotes file 2009-06-26 16:47:57 -06:00
Brian Paul
2a41df86a3 docs: bring over news updates from 7.4 branch 2009-06-26 16:46:21 -06:00
Brian Paul
318122b60a docs: bring in 7.4.3 and 7.4.4 release notes, news 2009-06-26 16:45:54 -06:00
Brian Paul
dd585db687 docs: increase max varying vars to 16 2009-06-26 16:41:54 -06:00
Brian Paul
f08bebfe24 mesa: raise MAX_VARYING (number of shader varying vars) to 16
16 is the limit for now because of various 32-bit bitfields.

(cherry picked from master, commit 4e762395ef)
2009-06-26 16:41:04 -06:00
Ian Romanick
2d86503471 intel / DRI2: Additional flush of fake front-buffer to real front-buffer
To maintain correctness, the server will copy the real front-buffer to
a newly allocated fake front-buffer in DRI2GetBuffersWithFormat.
However, if the DRI2GetBuffersWithFormat is triggered by glViewport,
this will copy stale data into the new buffer.  Fix this by flushing
the current fake front-buffer to the real front-buffer in
intel_viewport.

Fixes bug #22288.
2009-06-26 13:32:26 -07:00
Brian Paul
077a06c140 mesa: bump version to 7.5-rc4 2009-06-26 13:16:34 -06:00
Brian Paul
62ad606065 docs: document for/continue bug fix 2009-06-26 13:16:34 -06:00
Brian Paul
928e1ce47f cell: PIPE_CAP_TGSI_CONT_SUPPORTED query 2009-06-26 13:16:34 -06:00
Brian Paul
af7fb892d8 softpipe: PIPE_CAP_TGSI_CONT_SUPPORTED query 2009-06-26 13:16:34 -06:00
Brian Paul
f5dc352e5f gallium: added PIPE_CAP_TGSI_CONT_SUPPORTED 2009-06-26 13:16:34 -06:00
Brian Paul
e80ecdf659 glsl: move/simplify error checking for 'return' statements 2009-06-26 13:16:34 -06:00
Brian Paul
8e6dd8bf79 glsl: overhaul 'return' statement handling
A new node type (SLANG_OPER_RETURN_INLINED) is used to denote 'return'
statements inside inlined functions which need special handling.

All glean glsl1 tests pass for EmitContReturn=FALSE and TRUE.
2009-06-26 13:16:34 -06:00
Brian Paul
aa48becb82 glsl: predicate assignments according to __returnFlag
Fixes glean "function with early return (3)" case (when EmitContReturn=FALSE).
2009-06-26 13:16:34 -06:00
Brian Paul
16787c513b glsl: added slang_variable::is_global field 2009-06-26 13:16:34 -06:00
Brian Paul
ac05996b81 glsl: silence a problem warning 2009-06-26 13:16:34 -06:00
Brian Paul
0efd25b502 glsl: code refactoring for return statements 2009-06-26 13:16:34 -06:00
Brian Paul
2ae297c318 glsl: fix assorted regressions related to early-return-removal 2009-06-26 13:16:34 -06:00
Brian Paul
ddf64be258 glsl: comments, field reordering 2009-06-26 13:16:34 -06:00
Brian Paul
f652f15e6d glsl: rework loop nesting code 2009-06-26 13:16:34 -06:00
Brian Paul
dd453fa37c glsl: remove test for loop unrolling when we hit conditional cont/break
This is no longer needed since we added the new
_slang_loop_contains_continue_or_break() function/test.
2009-06-26 13:16:34 -06:00
Brian Paul
2f1c5c58b3 glsl: checkpoint: predicate __retVal = expr with __returnFlag
The glean "function with early return (1)" test passes now.
2009-06-26 13:16:34 -06:00
Brian Paul
65eaafee25 glsl: use new helper functions in _slang_gen_logical_and/or() 2009-06-26 13:16:33 -06:00
Brian Paul
e139434d44 glsl: add comments 2009-06-26 13:16:33 -06:00
Brian Paul
b04605d544 glsl: checkpoint: replace 'return' with __returnFlag=true;
Needed for "remove early returns" transformation.
2009-06-26 13:16:33 -06:00
Brian Paul
515513b409 glsl: fix up scoping for parent/children in slang_operation_copy()
This will need more testing, but no regressions seen so far.
2009-06-26 13:16:33 -06:00
Brian Paul
09313043e7 glsl: fix uninitialized var in _slang_gen_for_without_continue() 2009-06-26 13:16:33 -06:00
Brian Paul
5951ab311d glsl: added slang_operation_free_children() 2009-06-26 13:16:33 -06:00
Brian Paul
e5b53c071b glsl: added slang_oper_num_children() helper 2009-06-26 13:16:33 -06:00
Brian Paul
3c6480ea42 glsl: check-point: declare _returnFlag 2009-06-26 13:16:33 -06:00
Brian Paul
fc0896b50b glsl: added slang_operation_insert_child() 2009-06-26 13:16:33 -06:00
Brian Paul
f4b1a69b7d glsl: use slang_generate_declaration() to consolidate some code 2009-06-26 13:16:33 -06:00
Brian Paul
454a717d94 glsl: remove obsolete comment 2009-06-26 13:16:33 -06:00
Brian Paul
02edc8da36 st/mesa: query PIPE_CAP_TGSI_CONT_SUPPORTED 2009-06-26 13:16:33 -06:00
Brian Paul
08025cd4a5 glsl: implement _slang_gen_while_without_continue() 2009-06-26 13:16:33 -06:00
Brian Paul
2102e301a7 glsl: fix a bug involving 'continue' in 'for' loops
Need to execute the for loop's increment code before we continue.
Add a slang_assemble_ctx::CurLoopOper field to keep track of the containing
loop and avoid the "cont if true" path in this situation.

Plus, assorted clean-ups.
2009-06-26 13:16:33 -06:00
Brian Paul
541594b044 glsl: added slang_oper_child_const() 2009-06-26 13:16:32 -06:00
Brian Paul
38ddbc5588 glsl: use _slang_loop_contains_continue_or_break() to check for unrolling
The previous test failed for nested loops.
2009-06-26 13:16:32 -06:00
Brian Paul
4dafac2b2f glsl: use new _slang_loop_contains_continue() helper function 2009-06-26 13:16:32 -06:00
Brian Paul
aba93643be glsl: implement continue->break translation for do-while loops 2009-06-26 13:16:32 -06:00
Brian Paul
7e0eaca201 glsl: added slang_operation_literal_int/bool() helper functions 2009-06-26 13:16:32 -06:00
Brian Paul
c1f74a6734 glsl: don't allocate 0-length children array in slang_operation_copy() 2009-06-26 13:16:32 -06:00
Brian Paul
f38872473c glsl: remove debug code, misc clean-up 2009-06-26 13:16:32 -06:00
Brian Paul
f66733bbee glsl: implement continue->break transformation for for-loops 2009-06-26 13:16:32 -06:00
Brian Paul
c4fd947bee glsl: added slang_operation_add_children() and slang_oper_child() helpers 2009-06-26 13:16:32 -06:00
Brian Paul
c20bb48d3a glsl: added slang_assemble_ctx::EmitContReturn field, init 2009-06-26 13:16:32 -06:00
Brian Paul
eb1eee03a6 demos: improve argv parsing in fslight.c 2009-06-26 13:16:32 -06:00
Brian Paul
4bc74a0756 glsl: don't unroll loops containing continue/break
Just search the AST in _slang_can_unroll_for_loop().
2009-06-26 13:16:32 -06:00
Brian Paul
625b0fe268 Revert "slang: if/else/break & if/else/continue work for unrolled loops"
We should just check if the loop contains a continue/break in the
_slang_can_unroll_for_loop() test function...

This reverts commit 989856bde4.

Conflicts:

	src/mesa/shader/slang/slang_codegen.h
2009-06-26 13:16:32 -06:00
Brian Paul
4031ea1520 glsl: Added gl_shader_state::EmitContReturn field
This is the start of a glsl-continue-return feature branch to support
a GLSL code generator option for 'continue' and 'return' statements.
Some targets don't support CONT or RET statements so we'll need to
try to generate code that does not use them...
2009-06-26 13:16:32 -06:00
Brian Paul
84c5e4805b docs: updated Mesa release instructions 2009-06-26 13:16:32 -06:00
José Fonseca
72aed16aee scons: Tool to build with DirectX SDK.
Also works with MinGW, as long as the path to the DirectX SDK top
directory is set in the DXSDK_DIR environment variable.
2009-06-26 19:57:47 +01:00
José Fonseca
25f6c936fe scons: Don't use C specific options with g++ 2009-06-26 19:57:46 +01:00
Keith Whitwell
3e94521912 tgsi: correct handling of return value from util_vsnprintf
We were failing to deal with:
  - vsnprintf returns negative value on error.
  - vsnprintf returns the number of chars that *would* have been
    written on truncation.
2009-06-26 13:45:34 +01:00
Keith Whitwell
c9f8c400ab aux/indices: don't use 'prim' value once it is known to be bad
Theoretical bugfix only - no known case where this might happen.
2009-06-26 13:44:20 +01:00
José Fonseca
c25534f30d wgl: Handle flush after a window is destroyed.
Fixes assertion failure with conform.
2009-06-24 15:23:44 +01:00
Brian Paul
b79e6a59d8 demos: fix issues in glxcontexts.c
The reshape() function was called when there was no GLX context so
the viewport/modelview/projection setup wasn't doing anything.  Move
the call to reshape() into draw().

Also, remove -stereo, -fullscreen options and do some general clean-up.
2009-06-23 09:31:27 -06:00
Roland Scheidegger
2f184d0d9f i965: handle OPCODE_SWZ in the glsl path
glsl compiler will not generate OPCODE_SWZ, and as a first step it would
be translated away to a MOV anyway (why?), but later internally this opcode is
generated (for EXT_texture_swizzling).
(cherry picked from commit 4ef1f8e3b5)
2009-06-22 15:15:20 -07:00
Owen W. Taylor
9d367d43b2 Disable SGI_swap_control extension for DRI2
We currently don't have support for SGI_swap_control for direct
contexts with DRI2, so disable reporting the extension. Reporting
the extension, and then having glXSwapIntervalSGI() "succeed"
but do nothing can confuse applications.

https://bugs.freedesktop.org/show_bug.cgi?id=22123
(cherry picked from commit 279143c6e8)
2009-06-22 15:15:20 -07:00
Michel Dänzer
0584b6e433 intel: intel_texture_drawpixels() can't handle GL_DEPTH_STENCIL.
Fixes glean depthStencil test.
(cherry picked from commit 3885b708fd)
2009-06-22 15:15:20 -07:00
Brian Paul
19218fe712 i965: added intelFlush() call in intel_get_tex_image()
Fixes the render-to-texture test in progs/tests/getteximage.c
(cherry picked from commit a03b349153)
2009-06-22 15:15:20 -07:00
Brian Paul
a5b7e0c7d7 mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS/ in NV funcs
(cherry picked from commit 4dc426c016)
2009-06-22 15:15:20 -07:00
Brian Paul
54f425b5ce mesa: rename MAX_VERTEX_ATTRIBS to MAX_VERTEX_GENERIC_ATTRIBS
Be clearer that this is the number of generic vertex program/shader
attributes, not counting the legacy attributes (pos, normal, color, etc).
(cherry picked from commit 4a95185c9f)
2009-06-22 15:15:19 -07:00
Brian Paul
810df8317d mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS
(cherry picked from commit d2a74d76c9)
2009-06-22 15:15:19 -07:00
Brian Paul
19ca5ee1db mesa: fix some potential state-restore issues in pop_texture_group()
Call the _mesa_set_enable() functions instead of driver functions, etc.

Also, add missing code for 1D/2D texture arrays.
(cherry picked from commit aac19609bf)
2009-06-22 15:15:19 -07:00
Brian Paul
ad0514b24d vbo: return VP_NONE from get_program_mode() if running fixed-func vertex program
If we're running a vertex program to emulated fixed-function, we still need
to treat vertex arrays/attributes as if we're in fixed-function mode.

This should probably be back-ported to Mesa 7.5 after a bit more testing.
(cherry picked from commit dda82137d2)
2009-06-22 15:15:19 -07:00
Brian Paul
00e203fe17 mesa: create/use a fallback texture when bound texture is incomplete
When a GLSL sampler reads from an incomplete texture it should
return (0,0,0,1).  Instead of jumping through hoops in all the drivers
to make this happen, just create/install a fallback texture with those
texel values.

Fixes piglit/fp-incomplete-tex on i965 and more importantly, fixes some
GPU lockups when trying to sample from missing surfaces.  If a binding
table entry is NULL, it seems that sampling sometimes works, but not
always (lockup).

Todo: create a fallback texture for each type of texture target?
(cherry picked from commit 3f25219c7b)
2009-06-22 15:15:19 -07:00
Eric Anholt
abfd56c24c intel: Fix other metaops versus GL_COMPILE_AND_EXECUTE dlists.
Fixes oglconform zbfunc.c and pxtrans-cidraw.c, at least.

(cherry picked from commit 405300bb19)
2009-06-19 16:57:06 -07:00
Eric Anholt
daacac1c24 intel: Fix glClear behavior versus display lists.
The CALL_DrawArrays was leaking the clear's primitives into the display
list with GL_COMPILE_AND_EXECUTE.  Use _mesa_DrawArrays instead, which
doesn't appear to leak.  Fixes piglit dlist-clear test.
(cherry picked from commit 64edde1004)
2009-06-19 16:54:59 -07:00
Roland Scheidegger
43bb78f2bb radeons: use dp4 for position invariant vertex programs
Fixes #22181. R200 requires this since DP4 is used in hw tnl mode.
R300 prefers it (should be faster due to no instruction dependencies), but
both methods should be correct (when sw tcl is used though, MUL/MAD might
be faster). Probably doesn't make much difference for R100 since vertex progs
are executed in software anyway, but let's just keep it the same there too.
2009-06-19 20:00:55 +02:00
Michel Dänzer
9dfce365c7 Also release direct rendering resources in glXDestroyGLXPixmap.
Fixes leak running compiz with direct rendering.
2009-06-19 18:00:49 +02:00
Michel Dänzer
a120778c72 Always free image offsets memory when re-initializing texture image fields.
Fixes leak running compiz with direct rendering.
2009-06-19 18:00:33 +02:00
José Fonseca
3cf92e936a scons: Output the friendly "Linking ..." message when creating DLLs with MinGW. 2009-06-19 16:08:38 +01:00
Brian Paul
0487656245 softpipe: return alpha=1 in shadow_compare() function
The alpha value wasn't set at all before so we got unpredictable results.

Note that we don't currently obey GL_DEPTH_TEXTURE_MODE in the state
tracker.  For now, we return the result in the default mode (r,r,r,1).
2009-06-19 08:53:15 -06:00
José Fonseca
8f382fd3f3 util: Add cast.
It is expected to loose precision here.
2009-06-18 14:54:09 +01:00
José Fonseca
21bfd0f4bd draw: Replace pointer arithmetic with cast.
Using uintptr_t as intermediate type for pointer -> integer conversions is
easier to understand and does not cause any size mismatch warnings.
uintptr_t is part of C99, and we already provide a suitable replacement
definition for all platforms we care about.
2009-06-18 14:54:09 +01:00
José Fonseca
d609df1dae trace: Use size_t consistently. 2009-06-18 14:54:09 +01:00
José Fonseca
2af0173e9e pipebuffer: Use a type consistently for sizes/offsets.
Avoids warnings on 64bit builds.

Use regular unsigned since that's what gallium expects, but use a
typedef to facilitate possible changes in the future.
2009-06-18 14:54:08 +01:00
José Fonseca
42882897c6 wgl: Fix window resizing in multithread applications.
In multithreading stw_call_window_proc can be called by a thread other
than the thread where the context is bound.
2009-06-18 14:54:07 +01:00
José Fonseca
4b4855c717 wgl: Move all thread related code together.
Not only for cosmetic reasons, but also because we need to set the
SetWindowsHookEx hook for threads created before the DllMain is called
(threads for each we don't get the DLL_THREAD_ATTACH notification).
2009-06-18 14:54:07 +01:00
Keith Whitwell
1b05b5b4fe glew: correct misspelling of glFramebufferTextureLayer
This was misspelt as glFramebufferTexturLayer (missing e), causing
conflicts with the correctly spelt version in glext.h and extfuncs.h.
2009-06-18 10:13:55 +01:00
Keith Whitwell
0491142152 mesa: protect Elements against multiple definitions
Mesa and gallium both have a definition of this macro
2009-06-18 09:53:45 +01:00
Brian Paul
39366ed995 intel: remove extra \n from warning string
(cherry picked from commit 42e9bde0fa)
2009-06-17 12:55:26 -07:00
Robert Ellison
d446d3acac i965: fix 1D texture borders with GL_CLAMP_TO_BORDER
With 1D textures, GL_TEXTURE_WRAP_T should be ignored (only
GL_TEXTURE_WRAP_S should be respected).  But the i965 hardware
seems to follow the value of GL_TEXTURE_WRAP_T even when sampling
1D textures.

This fix forces GL_TEXTURE_WRAP_T to be GL_REPEAT whenever 1D
textures are used; this allows the texture to be sampled
correctly, avoiding "imaginary" border elements in the T direction.

This bug was demonstrated in the Piglit tex1d-2dborder test.
With this fix, that test passes.
(cherry picked from commit ab6c4fa582)
2009-06-17 12:55:26 -07:00
Robert Ellison
56235ae504 i965: send all warnings through _mesa_warning()
One warning message:
   drm_i915_getparam: -22

was still being sent to fprintf().  This causes all Piglit tests to fail,
even with MESA_DEBUG=0.

Using _mesa_warning() to emit the message allows the general Mesa controls
for messages like this to be applied.
(cherry picked from commit bc3270e99f)
2009-06-17 12:55:26 -07:00
Robert Ellison
e15aebe10e i965: fix segfault on low memory conditions
When out of memory (in at least one case, triggered by a longrunning
memory leak), this code will segfault and crash.  By checking for the
out-of-memory condition, the system can continue, and will report
the out-of-memory error later, a much preferable outcome.
(cherry picked from commit 44a4abfd4f)
2009-06-17 12:55:26 -07:00
Ian Romanick
a70c45bdab Fast path when rebinding the same texture in single context environment
If there is no shared context, there is no purpose in rebinding the same
texture.  In some artificial tests this improves performance 10% - 30%.
(cherry picked from commit 7f8000db8b)
2009-06-17 12:55:26 -07:00
Eric Anholt
ff3da0966f i915: Don't put VBOs in graphics memory unless required for an operation.
This saves doing swtnl from uncached memory, which is painful.  Improves
clutter test-text performance by 10% since it started using VBOs.
(cherry picked from commit a945e203d4)
2009-06-17 11:08:36 -07:00
Eric Anholt
1b8e4dd2c8 i915: Fall back on NPOT textured metaops on 830-class.
(cherry picked from commit 8ec6e03679)
2009-06-17 11:08:28 -07:00
Eric Anholt
cee73ffdaf i915: Restore the Viewport and DepthRange functions on 8xx.
Fixes failed viewport updates on glxgears (and other apps) resize since
e41780fedc.

Bug #20473.
(cherry picked from commit 0e83e8f51a)
2009-06-17 11:08:13 -07:00
Eric Anholt
7805c3b57b i956: Make state dependency of SF on drawbuffer bounds match Mesa's.
Noticed while debugging a weird 1D FBO testcase that left its existing
viewport and projection matrix in place when switching drawbuffers.  Didn't
fix the testcase, though.
(cherry picked from commit 3a521d84ec)
2009-06-17 11:07:03 -07:00
Eric Anholt
97974b7e51 intel: Don't complain on falling back from PBO fastpaths.
Instead, stash the debug info under the handy debug flag.

Bug #20053
(cherry picked from commit 22690482e6)
2009-06-17 11:06:52 -07:00
Eric Anholt
957f3c8c3d mesa: Mark FBOs with compressed color attachments as FBO-incomplete.
Both EXT_fbo and ARB_fbo agree on this.  Fixes a segfault in the metaops
mipmap generation in Intel for SGIS_generate_mipmap of S3TC textures in
Regnum Online.

Bug #21654.
(cherry picked from commit 0307e609aa)
2009-06-17 11:06:46 -07:00
Eric Anholt
66bfd025c8 i915: Use Stencil.Enabled instead of Stencil._Enabled in DrawBuffers.
The _Enabled field isn't updated at the point that DrawBuffers is called,
and the Driver.Enable() function does the testing for stencil buffer
presence anyway.

bug #21608 for Radeon
(cherry picked from commit 4c6f829899)
2009-06-17 11:06:38 -07:00
Eric Anholt
fbd554d074 i915: Only use the new 945 cube layout for compressed textures.
The docs actually explain this, but not in a terribly clear manner.
This nearly fixes the piglit cubemap testcase, except that something's
going wrong with the nearest filtering at 2x2 sizes in the testcase.
Looks good by visual inspection, though.

Bug #21692
(cherry picked from commit 5c5a468848)
2009-06-17 11:06:25 -07:00
Eric Anholt
6e0df938d4 i965: Fix varying payload reg assignment for the non-GLSL-instructions path.
I don't have a testcase for this, but it seems clearly wrong.
(cherry picked from commit dc657f3929)
2009-06-17 11:05:55 -07:00
Eric Anholt
988b61be27 i965: Fix register allocation of GLSL fp inputs.
Before, if the VP output something that is in the attributes coming into
the WM but which isn't used by the WM, then WM would end up reading subsequent
varyings from the wrong places.  This was visible with a GLSL demo
using gl_PointSize in the VS and a varying in the WM, as point size is in
the VUE but not used by the WM.  There is now a regression test in piglit,
glsl-unused-varying.

(cherry picked from commit 0f5113deed)
2009-06-17 11:04:31 -07:00
Eric Anholt
320a303be0 intel: Use FRONT_AND_BACK for StencilOp as well.
(cherry picked from commit 64980125c7)
2009-06-17 10:52:56 -07:00
Eric Anholt
d9e35d51fd intel: Use GL_FRONT_AND_BACK for stencil clearing.
This comes from a radeon-rewrite fallback fix, but may also fix stencil
clear failure when the polygon winding mode is flipped.
(cherry picked from commit d866abeffc)
2009-06-17 10:52:54 -07:00
Eric Anholt
61a2c9668f intel: Skip the DRI2 renderbuffer update when doing Viewport on an FBO.
(cherry picked from commit d4a42b0ce6)
2009-06-17 10:52:49 -07:00
Eric Anholt
2770107d87 intel: Map write-only buffer objects through the GTT when possible.
This looks to be a win of a few percent in cairogears with new vbo code,
thanks to not polluting caches.
(cherry picked from commit aa422b2625)
2009-06-17 10:52:30 -07:00
Brian Paul
3f856c6b6b mesa: rework viewport/scissor initialization code
The first time a context is bound to a drawable, the viewport and scissor
bounds are initialized to the buffer's size.  This is actually a bit tricky.

A new _mesa_check_init_viewport() function is called in several places
to check if the viewport has been initialized.  We also use a new
ctx->ViewportInitialized flag instead of the overloaded
ctx->FirstTimeCurrent flag.
2009-06-17 08:38:38 -06:00
Brian Paul
d18c57aaea mesa: added null ptr check in Fake_glXCreatePixmap()
Fixes segfault in progs/xdemos/glxgears_pixmap.c
2009-06-17 08:38:38 -06:00
Brian Paul
3705f48688 st/glx: added null ptr check in Fake_glXCreatePixmap()
Fixes segfault in progs/xdemos/glxgears_pixmap.c
2009-06-17 08:38:38 -06:00
José Fonseca
c6f71eabd8 Revert "scons: Debug build by default."
Per Brian's request.

This reverts commit 25f0c33bb3.
2009-06-17 15:24:06 +01:00
José Fonseca
1bee650ef3 progs/wgl: Fix shreadtex_mt too. 2009-06-17 15:23:25 +01:00
José Fonseca
6e24fdeae5 progs/wgl: Tweak the initialization wait in wglthreads.
There was still a non-zero probability for wglShareLists of failing.
2009-06-17 15:23:25 +01:00
José Fonseca
557421b6de progs/wgl: Get wglShareLists working in wglthreads.
wglShareLists is a little picky -- it seems to check if it has exclusive
access to a lock, and fails if it doesn't.

This allows the texture to be shared with all windows.
2009-06-17 15:23:25 +01:00
José Fonseca
25f0c33bb3 scons: Debug build by default.
Match what autotools and other build systems do by default.
2009-06-17 15:23:24 +01:00
Brian Paul
c53705ed7b GLX: attempt to fix glean makeCurrent test cases.
Two parts to this:

One we don't keep pointers to possibly freed memory anymore once we unbind the
drawables from the context. Brian I need to figure out what the comment
you made there, can we get a glean/piglit test so we can fix it properly?

If the new gc is the same as the oldGC, we call the unbind even though
we just bound it in that function. doh.

(cherry picked from master, commit 77506dac8e)
2009-06-17 08:03:19 -06:00
José Fonseca
ebe0796ba2 docs: Document building with SCons. 2009-06-17 10:12:11 +01:00
José Fonseca
d22828f716 wgl: Factor out some repetitive code into inline functions. 2009-06-17 10:08:25 +01:00
José Fonseca
992000cce7 progs/wgl: Allow resizing wglthreads' windows. 2009-06-17 10:08:24 +01:00
Brian Paul
6b917d0b17 i965: fix bugs in projective texture coordinates
For the TXP instruction we check if the texcoord is really a 4-component
atttibute which requires the divide by W step.  This check involved the
projtex_mask field.  However, the projtex_mask field was being miscalculated
because of some confusion between vertex program outputs and fragment
program inputs.

1. Rework the size_masks calculation so we correctly set bits corresponding
to fragment program input attributes.

2. Rename projtex_mask to proj_attrib_mask since we're interested in more
than just texcoords (generic varying vars too).

3. Simply the indexing of the size_masks and proj_attrib_mask fields.

4. The tracker::active[] array was mis-dimensioned.  Use MAX_PROGRAM_TEMPS
instead of a magic number.

5. Update comments, add new assertions.

With these changes the Lightsmark demo/benchmark renders correctly, until
we eventually hit a GPU lockup...
2009-06-16 18:21:26 -06:00
Brian Paul
742ba08406 softpipe: fix out of bounds quad rasterization bug
For some triangles we can generate quads which lie just outside the
surface bounds.  Just check the quad's mask before trying to emit/process
the quad.

Fixes failed assertion in Lightsmark.
2009-06-16 15:41:49 -06:00
Brian Paul
3e48dd0445 mesa: fix incorrect viewport clamping in _mesa_set_viewport()
A 0 by 0 viewport size is legal.  Don't clamp against lower bound of one.
The error checking earlier in the function prevents negative values.
2009-06-16 09:34:35 -06:00
Brian Paul
ed7f4b4230 mesa: fix REMAINDER() macro
The results were incorrect for some negative values of A.
See bug 21872.
2009-06-16 08:45:56 -06:00
José Fonseca
3463b1479d gallium: Avoid atomic ops / locking when src is dst. 2009-06-16 13:05:25 +01:00
José Fonseca
077c5e62d8 progs/wgl: Quit after displaying usage for -h option. 2009-06-16 12:34:29 +01:00
José Fonseca
06075711af progs/wgl: Use appropriate types to silence msvc warnings. 2009-06-16 12:29:58 +01:00
José Fonseca
566bdbe67d progs/wgl: Fix assertion failure in wglthreads' texture creation. 2009-06-16 12:29:58 +01:00
Shuang He
d027e8feff intel: Release fb backing regions in intelDestroyBuffer()
Fixes memory leak when destroying framebuffers.
2009-06-15 16:19:30 -06:00
José Fonseca
227d233cff python/tests: Add is_depth_stencil_format utility function. 2009-06-15 19:22:35 +01:00
José Fonseca
7585cbffe0 python/tests: Cleanup texture_sample. 2009-06-15 19:21:58 +01:00
José Fonseca
c6af9b2947 mesa: Always return a value. 2009-06-15 19:20:25 +01:00
José Fonseca
053d8eb891 mesa: Use appropriate float/integer types. 2009-06-15 19:20:05 +01:00
José Fonseca
6214c7262f mesa: Use type modifier for float constants. 2009-06-15 19:19:29 +01:00
José Fonseca
37f2117cd1 mesa: Use integer type with appropriate sign. 2009-06-15 19:17:07 +01:00
José Fonseca
c33ef1f7c6 rtasm: Use 32bit constant.
As we're only using 32bit bitmasks.
2009-06-15 19:04:04 +01:00
José Fonseca
940cb7ce16 gallium: Ensure assert macro is defined before being used in p_thread.h 2009-06-15 18:57:45 +01:00
José Fonseca
5d0cf9ebb4 softpipe: Fix softpipe_is_texture_referenced.
Render results are only visible when the render cache is flushed.
softpipe_is_texture_referenced must reflect that or transfers to/from the
textures bound in the framebuffer won't be proceeded of the necessary
flush, causing transfer data to be outdated/clobbered.

This fixes conform drawpix test with softpipe.
2009-06-15 18:42:13 +01:00
José Fonseca
0e1abced56 progs/tests: Use opaque colors.
Transparency is not relevant for this example, and leads to distraction
due to different results in alpha visuals, when capturing images to disk.
2009-06-15 15:40:10 +01:00
Thomas Hellstrom
db22b35d21 dri st: Don't require the PIPE_TEXTURE_USAGE_RENDER_TARGET property for depth- and stencil renderbuffers.
Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
2009-06-15 11:48:57 +02:00
Thomas Hellstrom
cbe5af766e gallium: Fix segfault and valgrind error introduced with commit 3f2e006b75
Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
2009-06-15 11:22:06 +02:00
Brian Paul
fb64365642 demos: update fbotexture.c to use EXT or ARB functions exclusively
When the -arb option is specified we use GL_ARB_framebuffer_object intead
of GL_EXT_framebuffer_object.

For some vendors' OpenGL it's important to call the ARB entrypoints
instead of the EXT entrypoints to get correct behaviour.  Use some
function pointer tricks to do this (instead of GLEW).
2009-06-12 08:15:33 -06:00
Brian Paul
476685c63c util: additional function pointers 2009-06-12 08:15:33 -06:00
Jakob Bornecrantz
c6de08fff4 mesa: Enable uploads of only depth to z24s8 textures 2009-06-12 12:29:02 +01:00
Brian Paul
3754c4135c mesa: rework vertex shader output / fragment shader input attribute matching
Before, if a vertex shader's outputs didn't exactly match a fragment
shader's inputs we could wind up with invalid TGSI shader declarations.
For example:

Before patch:
DCL OUT[0], POSITION
DCL OUT[1], COLOR[1]
DCL OUT[2], GENERIC[0]
DCL OUT[3], GENERIC[0] <- note duplicate [0]
DCL OUT[4], GENERIC[2]

After patch:
DCL OUT[0], POSITION
DCL OUT[1], COLOR[1]
DCL OUT[2], GENERIC[0]
DCL OUT[3], GENERIC[1]
DCL OUT[4], GENERIC[2]
2009-06-11 14:58:25 -06:00
Brian Paul
322e8556b9 mesa: add default function for ctx->Driver.CheckQuery() hook 2009-06-11 14:58:25 -06:00
José Fonseca
0ddc38309a python/retrace: Show the contents of the depth/stencil and surfaces before/after transfers. 2009-06-11 20:46:07 +01:00
José Fonseca
e1700009b7 python/retrace: Interpret is_texture_referenced/is_buffer_referenced. 2009-06-11 19:24:48 +01:00
José Fonseca
d5ba39ad08 wgl: Fix prototype. 2009-06-11 19:05:46 +01:00
José Fonseca
de413b1ba9 mesa: Use new pf_is_depth_and_stencil inline. 2009-06-11 19:02:59 +01:00
José Fonseca
3f2e006b75 gallium: New pf_is_depth_and_stencil / pf_is_depth_or_stencil inlines. 2009-06-11 19:02:59 +01:00
José Fonseca
7cafd49c93 mesa: Use PIPE_TEXTURE_USAGE_DEPTH_STENCIL for any depth or stencil format. 2009-06-11 19:02:59 +01:00
José Fonseca
862c7b8cd3 mesa: Remove dead code. 2009-06-11 19:02:59 +01:00
Brian Paul
bb0b954f12 st/mesa: fix typo s/BFC0/BFC1/ 2009-06-11 10:40:19 -06:00
Brian Paul
9d5479eeeb vbo: fix assertion, #define IMM_BUFFER_NAME
This was sometimes seen when Glean exited upon test failure when using
Gallium.
2009-06-11 09:46:02 -06:00
José Fonseca
cc09724a50 python/tests: Test sampling from a depth texture. 2009-06-11 16:22:17 +01:00
Jakob Bornecrantz
41cf681535 mesa: Only do read write when we don't have a depth value to write 2009-06-11 15:37:53 +01:00
José Fonseca
e3f14f2f3b progs: Port fp programs to GLEW. 2009-06-11 13:19:34 +01:00
José Fonseca
48d816b8ff mesa: Take the format from the right structure. 2009-06-11 12:23:09 +01:00
José Fonseca
96aca15c9d meas: Use a read/write transfer when writing stencil component, but not touching the depth component. 2009-06-11 11:47:20 +01:00
José Fonseca
337f559cd2 mesa: Reverse s8z24 into z24s8 as required by EXT_packed_depth_stencil.
Actually, after spotting this problem, I realized this is unreachable
code. However don't bother to enable this fast path now, given the normal
path is working just fine.
2009-06-10 21:29:25 +01:00
José Fonseca
8fa8669aeb mesa: Fix typo in bitmask. 2009-06-10 21:25:54 +01:00
José Fonseca
0a4fcabe44 mesa: Fix draw_stencil_pixels for PIPE_FORMAT_Z24S8_UNORM.
Reversed component order.

This fixes glean depthStencil test failures for PIPE_FORMAT_Z24S8_UNORM
visuals.
2009-06-10 20:05:00 +01:00
Brian Paul
dbab657fe7 glsl: fix warnings, update comments, s/TRUE/GL_TRUE/
(cherry picked from master, commit 7fdd64ab29)
2009-06-10 12:22:36 -06:00
Brian Paul
9225b67383 glsl: Handle continuation characters in preprocessor.
(cherry picked from master, commit cc22620e4b)
2009-06-10 12:21:56 -06:00
Brian Paul
88527220e4 swrast: fix state validation bug for changing program constants
Add _NEW_PROGRAM_CONSTANTS to _SWRAST_NEW_DERIVED.
This makes sure that we update the fragment shader's constants when state
vars (such as point size) changes.
Fixes the progs/glsl/points.c demo.
2009-06-10 09:31:01 -06:00
Brian Paul
506989b20e glsl: Fix symbol replacement handling in preprocessor.
(cherry picked from master, commit d9617deb00)
2009-06-10 09:31:01 -06:00
Brian Paul
6f50c9865d mesa: disable texture unit error check in _mesa_MatrixMode()
See comments for details.
2009-06-10 09:31:01 -06:00
Brian Paul
5450281ff7 docs: document GLSL preprocessor fixes 2009-06-10 09:31:01 -06:00
José Fonseca
4d16eb5e18 util: Single precision constants. 2009-06-10 15:39:47 +01:00
José Fonseca
978bca8b2a mesa: Single precision constants. 2009-06-10 15:39:34 +01:00
José Fonseca
52411a1951 mesa: Pure software accum buffer.
The existing implementation was already implemented on software, but relied
on the pipe driver to always support the R16G16B16A16_SNORM format. This
patch eliminates that, without prejudice against a future hardware-only
implementation.

It also avoids some of the short <-> float conversions, and only does a read
transfer of the color buffer on GL_RETURN if absolutely necessary.
2009-06-10 15:39:02 +01:00
José Fonseca
8bfbb7ec8b gallium: Shorthand functions for computing stride and sizes for a rect. 2009-06-10 15:31:12 +01:00
Keith Whitwell
76a1017e97 mesa/st: fix tracking of mapped buffer ranges
In st_bufferobj_map_range(), set obj->Offset consistently with its
usage elsewhere.
2009-06-09 18:32:18 +01:00
Keith Whitwell
9192347443 stw: ignore swapbuffer requests on singlebuffer
Return TRUE in this case.  Returning FALSE seems to result in
mis-rendering -- possibly opengl32.dll is trying to compensate by
doing a software blit??
2009-06-09 16:37:38 +01:00
Brian Paul
cb549775a5 glsl: Expand nested preprocessor macros.
(cherry picked from master, commit ef8caec29a)
2009-06-09 09:14:38 -06:00
Brian Paul
34bb024cf2 st/mesa: fix incorrect bufObj Length assignment, remove unneeded assertion 2009-06-08 16:11:17 -06:00
Jon TURNEY
7eed6ab5b5 Cygwin build fixes
Fix mklib to deal with NOPREFIX and use --enable-auto-image-base for cygwin
Teach configure.ac some basic facts about cygwin

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-06-08 14:30:46 -06:00
Brian Paul
304ba4bba4 glsl: Fix preprocessor define argument parsing for dead sections.
(cherry picked from master, commit 19a54d9f10)
2009-06-08 13:53:33 -06:00
Jakob Bornecrantz
77c329a277 pipebuffer: Silence out of heap space debug print 2009-06-08 19:54:55 +02:00
Brian Paul
b6753adbc7 st/mesa: remove invalid assertion
It's legal for ARB_vertex_program programs to not write to result.position.
The results are undefined in that case.  This assertion was causing us to
abort/exit though.
2009-06-08 10:46:46 -06:00
José Fonseca
e09f78d8dc mesa: Use matching signedness for the counter as upper bound. 2009-06-08 16:56:41 +01:00
José Fonseca
42678dba94 mesa: Allocate tokens from the heap.
The recent increase ST_MAX_SHADER_TOKENS to 8K causes stack overflows on
windows.

Failure to allocate is not being propagated to the caller. This is not
a regression since the previous _mesa_malloc result wasn't being
checked as well. Unfortunately it is not easy to fix, as the callers of
these functions do not have failure propagation mechanism either, and
so on. So leaving a just fixme note for now.
2009-06-08 16:56:41 +01:00
Brian Paul
33d6327770 mesa: better error message for invalid texture unit index 2009-06-08 09:53:00 -06:00
Brian Paul
0bced6a326 mesa: bump MAX_PROGRAM_ENV_PARAMS from 128 to 256
Also, MAX_NV_VERTEX_PROGRAM_PARAMS should be 96, not 128 (or 256).
2009-06-08 09:53:00 -06:00
Keith Whitwell
0d3c8fbf12 mesa/vbo: drop all references to vbo on destroy
We were adding references to the input arrays, but failing to drop
them on destruction.  This could lead to a 64kb buffer being leaked
each context destruction.
2009-06-08 16:27:43 +01:00
Brian Paul
fce4ee12a6 mesa: EXT_vertex_array_bgra fixes
1) Pass the correct format when calling update_array in
   _mesa_VertexAttribPointerARB.
2) glVertexAttribPointerNV accepts GL_BGRA format too.
3) raise INVALID_VALUE error when format is BGRA and normalized is
   false in glVertexAttribPointerARB

(cherry picked from commit 4adb190a16)
2009-06-08 07:25:24 -06:00
Jakob Bornecrantz
4d9d0e6230 stw: If stfb not set don't call into mesa 2009-06-08 14:45:56 +02:00
Jakob Bornecrantz
283e84bfb3 progs/tests: Add some scissor tests 2009-06-08 14:45:40 +02:00
José Fonseca
78dad27564 Revert "scons: Less aggressive optimizations for MSVC 64bit compiler."
This reverts commit fc7f924782.
2009-06-08 11:13:41 +01:00
Brian Paul
cfff2a6189 mesa: bump version to 7.5-rc3 2009-06-05 17:16:47 -06:00
Dan Nicholson
6453605785 osmesa: Link with -ldl for dlopen code
Now that the dlopen wrappers are built into libmesa.a, we need to link
standalone libOSMesa with libdl to resolve dlopen and friends on
platforms that need it.
(cherry picked from commit 4795dd5950)
2009-06-04 19:47:41 -07:00
Dan Nicholson
5df6468589 osmesa: Allow building standalone in all three channel widths
autoconf had been designating the 8 bit libOSMesa as the default
standalone osmesa, but the Makefile expected it to be linked to libGL.
Fix up the osmesa Makefile so that it allows any of the combinations of
standalone and channel width to be built.

Fixes bug #21980.
(cherry picked from commit 7441dcd90b)
2009-06-04 19:47:32 -07:00
Brian Paul
9424d81d18 softpipe: separate case for PIPE_PRIM_POLYGON in sp_vbuf_draw()
Because of flat shading, we can't use same code as PIPE_PRIM_TRIANGLE_FAN.
This is a follow-on to commit a59575d8fb.

(cherry picked from commit 086ecea179)
2009-06-04 13:13:14 -06:00
Brian Paul
6907650211 softpipe: fix incorrect tri vertex order for PIPE_PRIM_POLYGON rendering
This fixes incorrect front/back-face orientation.

(cherry picked from commit a64bbdaa3e)
2009-06-04 13:12:13 -06:00
Brian Paul
d37795c453 st/mesa: increase ST_MAX_SHADER_TOKENS to 8k 2009-06-04 13:10:31 -06:00
Brian Paul
45e744dddc tgsi: increase MAX_LABELS to 4096 2009-06-04 13:10:31 -06:00
José Fonseca
fc7f924782 scons: Less aggressive optimizations for MSVC 64bit compiler.
MSVC 64bit compiler takes forever on some of the files.

Might want to revisit this again later.
2009-06-02 18:41:12 -07:00
José Fonseca
0f50c4fab8 scons: Output nice summary messages instead of long command lines.
You can still get the old behavior by passing the option quiet=no to scons.
2009-06-02 18:23:12 -07:00
José Fonseca
273117ceed util: Unsaved change missing from last commit. 2009-06-02 16:41:45 -07:00
José Fonseca
840af5fd62 util: Support Z24S8/Z24X8 -> unsigned conversion. 2009-06-02 11:46:53 -07:00
José Fonseca
c91df4c153 util: Fix 24 to 32 bit expansion binary arithmetic expression.
When approaching y = x * 0xffffffff / 0xffffff with bit arithmetic, the
8 least significant bits of y should come from the
8 most significant bits of x.
2009-06-02 11:46:06 -07:00
Brian Paul
12e94d892e mesa: release VBO and PBO references upon context destruction 2009-06-02 10:29:39 -06:00
Brian Paul
cb3a9f984d mesa: add #define FEATURE_ARB_pixel_buffer_object 2009-06-02 10:29:38 -06:00
Ian Romanick
16fbd39129 intel: Clip to window after calling Driver.TexImage2D
This prevents the width / height from being clipped to the window size before
the texture is allocated.  This matches intelCopyTexImage1D.

This should fix bug #21227

Signed-off-by: Ian Romanick <ian.romanick@intel.com>
(cherry picked from commit 129f311673)
2009-06-02 16:52:03 +01:00
Keith Whitwell
1aef032d43 gallium/draw: Free specialized versions of driver shaders
The pstipple, aaline and aapoint code would create specialized versions
of shaders and upload them to the driver -- but never free them.
2009-06-01 20:35:38 -07:00
Keith Whitwell
003cfd4dd2 draw: free more token arrays
The AA line and point code also needs to free token arrays after
building driver shaders.
2009-06-01 20:35:38 -07:00
Keith Whitwell
69a765df1c draw: avoid leaking tokens when building pstipple fragment shader
Add missing FREE() after MALLOC().
2009-06-01 20:35:38 -07:00
Keith Whitwell
503632557e mesa/st: restore flush to copy_texsubimage (was previously finish)
Need a flush here even though the original finish was overkill.
2009-06-01 20:34:44 -07:00
José Fonseca
557d2bb423 wgl: Destroy the framebuffer when the window is destroyed. 2009-06-01 20:20:48 -07:00
Keith Whitwell
97f5953ced progs/vpglsl: add similar support for point rendering as progs/vp 2009-06-01 18:40:21 -07:00
Jakob Bornecrantz
f989390af6 st/gl: Fix mip gen for compressed textures 2009-06-01 18:40:12 -07:00
Keith Whitwell
00e7a60077 trivial/tri-z: add controls for depthrange min/max
Also add key to set up quake-1 style ztrick rendering with clear depth
1.0, deptrange(1.0, 0.0) and depthfunc GL_GREATER.
2009-06-01 18:39:58 -07:00
José Fonseca
3c756ed39f progs/wgl: Small cleanup to wglinfo. 2009-06-01 18:23:20 -07:00
José Fonseca
76ad2b4a5a progs/wgl: Use an invisible window in wglinfo. 2009-06-01 18:23:20 -07:00
Brian Paul
0e8a5a8474 st/mesa: fix incorrect sprite origin when drawing to FBO/texture
Need to take the draw buffer's up/down orientation into consideration
when setting the sprite_coord_mode field.

Fixes inverted sprites when drawing into an FBO.
2009-06-01 14:59:11 -06:00
Brian Paul
427554211b draw: reset extra_vp_outputs.slot to zero in widepoint_flush()
Fixes a crash when clearing the window with a quad after drawing large
points.  We were asking the draw module how many vertex shader outputs
there were and got 3 instead of 2.  This led to creating vertices with
too many attributes and trying to read invalid memory.

We reset extra_vp_outputs.slot to zero in the aaline/aapoint stage's
flush functions already.
This omission was just an oversight in the wide_point stage.
2009-06-01 14:28:57 -06:00
Brian Paul
a5d033e89b demos: add missing dependencies for util files 2009-06-01 11:23:39 -06:00
José Fonseca
ea3ee4791e wgl: Cleanup framebuffer destruction logic. 2009-05-31 17:16:26 -07:00
José Fonseca
0ea519f931 wgl: Ensure we only create framebuffers for HDC associated with a window. 2009-05-31 11:10:22 -07:00
José Fonseca
fe69b6bdc7 wgl: Use the right pixel format.
There is no current pixel format. Each HDC has its pixelformat which is
kept by gdi and set/get via the SetPixelFormat/GetPixelFormat functions.

Now the HDC's pixelformat is kept in the stw_framebuffer, which is
created during the SetPixelFormat.
2009-05-30 20:29:03 -07:00
José Fonseca
be7c56be06 wgl: Fix debugging output. 2009-05-30 20:29:03 -07:00
José Fonseca
76f2bacb07 wgl: Rename function. 2009-05-30 20:29:03 -07:00
José Fonseca
1124f786c1 wgl: Remove unused field. 2009-05-30 20:29:03 -07:00
José Fonseca
5bb2074798 mesa: Output warnings to debugger on Windows.
Stderr of Windows applications without console is not usually
visible.
2009-05-30 20:29:02 -07:00
José Fonseca
8aef306c34 mesa: Check/propagate return value on st_make_current.
Prevents segmentation fault when trying to set the viewport/scissor
after a context/drawable visual mismatch.
2009-05-30 20:29:02 -07:00
José Fonseca
29c6c8eb18 mesa: Add success/failures return value to _mesa_make_current. 2009-05-30 20:29:02 -07:00
Brian Paul
a59575d8fb softpipe: fix incorrect provoking vertex color for PIPE_PRIM_POLYGON
This fixes the incorrect colors seen when rendering flat-shaded polygons.
Note that clipped polygons were correct, but unclipped polygons were wrong.

See the glean/clipFlat test for regression testing.
2009-05-30 20:07:18 -06:00
Brian Paul
1045481dd9 mesa: fix loop over generic attribs in update_arrays() 2009-05-22 13:50:31 -06:00
Brian Paul
c3538969e1 vbo: fix crash in vbo_exec_bind_arrays()
When a vertex shader uses generic vertex attribute 0, but not gl_Vertex,
we need to set attribute[16] to point to attribute[0].  We were setting the
attribute size, but not the pointer.

Fixes crash in glsl/multitex.c when using the VertCoord attribute instead
of gl_Vertex.
2009-05-22 13:15:41 -06:00
Brian Paul
58fadc6242 demos: fix multitex.c VertCoord attribute mapping
If the multitex.vert shader uses the VertCoord generic vertex attribute
instead of the pre-defined gl_Vertex attribute, we need to make sure that
VertCoord gets bound to generic vertex attribute zero.

That's because we need to call glVertexAttrib2fv(0, xy) after all the other
vertex attributes have been set since setting generic attribute 0 triggers
vertex submission.  Before, we wound up issuing the vertex attributes in
the order 0, 1, 2 which caused the first vertex to be submitted before all
the attributes were set.  Now, the attributes are set in 1, 2, 0 order.
2009-05-22 13:00:49 -06:00
Brian Paul
995456f930 mesa: allow GL_BITMAP type in _mesa_image_image_stride()
It's possible to hand a GL_COLOR_INDEX/GL_BITMAP image to glTexImage3D()
which gets converted to RGBA via the glPixelMap tables.

This fixes a failure with piglit/fdo10370 with Gallium.
2009-05-22 09:35:02 -06:00
Brian Paul
42b747e57d mesa: added comment 2009-05-22 07:14:16 -06:00
Brian Paul
70c4b81e88 mesa: add missing glGet*() case for GL_VERTEX_ARRAY_BINDING_APPLE 2009-05-21 21:49:57 -06:00
Brian Paul
8da09e6924 vbo: fix incorrect loop limit in bind_array_obj()
The generic_array[] is 16 elements in size, but the loop was doing 32
iterations.  The out of bounds array write was clobbering the following
inputs[] array but as luck would have it, that didn't matter.
2009-05-21 16:54:35 -06:00
Brian Paul
d4fb7615b5 mesa: use MAX_ values instead of literals 2009-05-21 16:52:45 -06:00
Carl Worth
d2f4c2b632 minstall: Don't copy over an identical file
The rationale here is to avoid updating a timestamp for a file that
hasn't changed. Needless updates of the timestamp can ripple into
other projects, (xserver, etc.), useless recompiling due to a
'make install' in mesa that didn't actually change anything.
2009-05-21 07:52:13 -06:00
Mathias Fröhlich
042d9a5132 mesa: allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT
See sourceforge bug #2793846.
2009-05-19 09:59:01 -06:00
Brian Paul
c99a60c40d mesa: assign trb->Base.StencilBits in update_wrapper().
When we render to a depth/stencil texture there are stencil bits.
2009-05-19 09:57:01 -06:00
Brian Paul
7ce105d2e6 st/mesa: fix incorrect src/dst stride params to _mesa_generate_mipmap_level()
The stride needs to be in texels, not bytes.
2009-05-18 10:28:04 -06:00
Brian Paul
adabd0e81e mesa: comments for _mesa_generate_mipmap_level() 2009-05-18 10:27:31 -06:00
Brian Paul
30320f0afb softpipe: add texture target sanity check assertion 2009-05-18 10:13:44 -06:00
Brian Paul
14e5bff97b st: fix incorrect target parameter to screen->is_format_supported()
We were passing a GL texture target instead of a pipe_texture_target enum.
2009-05-18 10:12:40 -06:00
Brian Paul
df37cde309 mesa: added linux-osmesa-static config
Contributed by Nicolas Noble.  See SF bug #2792536
2009-05-18 08:47:22 -06:00
Brian Paul
6e61700541 docs: link to 7.5 relnotes 2009-05-18 07:17:46 -06:00
Brian Paul
da0d4e1db6 docs: emphasize the incomplete status of the nouveau/R300 gallium drivers 2009-05-18 07:17:36 -06:00
Aidan Thornton
f2445dfd85 Initialize psp->waitX/waitGL for swrast_dri.so.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21053 .
2009-05-18 12:47:00 +02:00
346 changed files with 13957 additions and 3228 deletions

View File

@@ -127,6 +127,7 @@ linux-icc \
linux-icc-static \
linux-llvm \
linux-osmesa \
linux-osmesa-static \
linux-osmesa16 \
linux-osmesa16-static \
linux-osmesa32 \
@@ -181,7 +182,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.5-rc2
VERSION=7.5.1
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)
@@ -387,7 +388,17 @@ GLW_FILES = \
$(DIRECTORY)/src/glw/glw.pc.in \
$(DIRECTORY)/src/glw/depend
GLEW_FILES = \
$(DIRECTORY)/include/GL/glew.h \
$(DIRECTORY)/include/GL/glxew.h \
$(DIRECTORY)/include/GL/wglew.h \
$(DIRECTORY)/src/glew/*.c \
$(DIRECTORY)/src/glew/Makefile \
$(DIRECTORY)/src/glew/SConscript \
$(DIRECTORY)/src/glew/LICENSE.txt
DEMO_FILES = \
$(GLEW_FILES) \
$(DIRECTORY)/progs/beos/*.cpp \
$(DIRECTORY)/progs/beos/Makefile \
$(DIRECTORY)/progs/images/*.rgb \

View File

@@ -66,8 +66,11 @@ if [ $# -ge 2 ] ; then
elif [ -f "$FILE" ] ; then
#echo "$FILE" is a regular file
$RM "$DEST/`basename $FILE`"
cp "$FILE" "$DEST"
# Only copy if the files differ
if ! cmp -s $FILE $DEST/`basename $FILE`; then
$RM "$DEST/`basename $FILE`"
cp "$FILE" "$DEST"
fi
if [ $MODE ] ; then
FILE=`basename "$FILE"`
chmod $MODE "$DEST/$FILE"

View File

@@ -885,6 +885,17 @@ case $ARCH in
CYGWIN*)
# GCC-based environment
if [ $NOPREFIX = 1 ] ; then
# No "lib" or ".so" part
echo "mklib: Making CYGWIN shared library: " ${LIBNAME}
OPTS="-shared -Wl,--enable-auto-image-base"
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
fi
rm -f ${LIBNAME}
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
FINAL_LIBS=${LIBNAME}
else
CYGNAME="cyg${LIBNAME}" # prefix with "cyg"
LIBNAME="lib${LIBNAME}" # prefix with "lib"
@@ -901,11 +912,11 @@ case $ARCH in
# finish up
FINAL_LIBS=${LIBNAME}.a
else
OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
fi
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll
echo "mklib: Making" $ARCH "shared library: " ${CYGNAME}-${MAJOR}.dll
if [ $CPLUSPLUS = 1 ] ; then
LINK="g++"
@@ -914,7 +925,8 @@ case $ARCH in
fi
# rm any old libs
rm -f ${LIBNAME}-${MAJOR}.dll
rm -f ${CYGNAME}-${MAJOR}.dll
rm -f ${LIBNAME}-${MAJOR}.dll.a
rm -f ${LIBNAME}.dll.a
rm -f ${LIBNAME}.a
@@ -927,6 +939,7 @@ case $ARCH in
# special case for installing in bin
FINAL_BINS="${CYGNAME}-${MAJOR}.dll"
fi
fi
;;
'example')
@@ -958,5 +971,6 @@ esac
#
if [ ${INSTALLDIR} != "." ] ; then
echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR}
test -d ${INSTALLDIR} || mkdir -p ${INSTALLDIR}
mv ${FINAL_LIBS} ${INSTALLDIR}/
fi

View File

@@ -55,7 +55,7 @@ def AddOptions(opts):
from SCons.Options.EnumOption import EnumOption
opts.Add(BoolOption('debug', 'debug build', 'no'))
opts.Add(BoolOption('profile', 'profile build', 'no'))
#opts.Add(BoolOption('quiet', 'quiet command lines', 'no'))
opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', default_platform,

View File

@@ -10,7 +10,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=5
MESA_TINY=0
MESA_TINY=1
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
# external projects. This should be useless now that we use libdrm.

View File

@@ -0,0 +1,37 @@
# Configuration for building static libOSMesa.a on Linux, no Xlib driver
# This doesn't really have any Linux dependencies, so it should be usable
# on other (gcc-based) systems.
include $(TOP)/configs/default
CONFIG_NAME = linux-osmesa
# Compiler and flags
CC = gcc -m32
CXX = g++ -m32
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS
CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
MKLIB_OPTIONS = -static
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
# Directories
SRC_DIRS = mesa glu
DRIVER_DIRS = osmesa
PROGRAM_DIRS = osdemos
# Dependencies
GL_LIB_DEPS =
OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
GLUT_LIB_DEPS =
GLW_LIB_DEPS =
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
$(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm

View File

@@ -121,6 +121,7 @@ AC_ARG_ENABLE([32-bit],
if test "x$enable_32bit" = xyes; then
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -m32"
ARCH_FLAGS="$ARCH_FLAGS -m32"
fi
if test "x$GXX" = xyes; then
CXXFLAGS="$CXXFLAGS -m32"
@@ -222,6 +223,8 @@ else
case "$host_os" in
darwin* )
LIB_EXTENSION='dylib' ;;
cygwin* )
LIB_EXTENSION='dll' ;;
* )
LIB_EXTENSION='so' ;;
esac
@@ -640,7 +643,7 @@ dnl Which drivers to build - default is chosen by platform
AC_ARG_WITH([dri-drivers],
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
[comma delimited DRI drivers list, e.g.
"swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
"swrast,i965,radeon" @<:@default=auto@:>@])],
[with_dri_drivers="$withval"],
[with_dri_drivers=yes])
if test "x$with_dri_drivers" = x; then
@@ -826,12 +829,12 @@ case "$mesa_driver" in
osmesa)
# only link libraries with osmesa if shared
if test "$enable_static" = no; then
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
else
OSMESA_LIB_DEPS=""
fi
OSMESA_MESA_DEPS=""
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
;;
*)
# Link OSMesa to libGL otherwise
@@ -845,9 +848,6 @@ osmesa)
OSMESA_PC_REQ="gl"
;;
esac
if test "$enable_static" = no; then
OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
fi
OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
AC_SUBST([OSMESA_LIB_DEPS])
AC_SUBST([OSMESA_MESA_DEPS])
@@ -1076,6 +1076,9 @@ if test "x$APP_LIB_DEPS" = x; then
solaris*)
APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
;;
cygwin*)
APP_LIB_DEPS="-lX11"
;;
*)
APP_LIB_DEPS="-lm"
;;
@@ -1143,6 +1146,21 @@ AC_ARG_WITH([xorg-driver-dir],
[XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
AC_SUBST([XORG_DRIVER_INSTALL_DIR])
AC_ARG_WITH([max-width],
[AS_HELP_STRING([--with-max-width=N],
[Maximum framebuffer width (4096)])],
[DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
AS_IF([test "${withval}" -gt "4096"],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
AC_ARG_WITH([max-height],
[AS_HELP_STRING([--with-max-height=N],
[Maximum framebuffer height (4096)])],
[DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
AS_IF([test "${withval}" -gt "4096"],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
dnl
dnl Gallium Intel configuration
dnl

View File

@@ -12,7 +12,7 @@
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>
<a href="http://wiki.freedesktop.org/wiki/Software/gallium" target="_parent">Gallium3D</a>
architecture.
Tungsten Graphics did the original implementation of the Cell driver.
</p>

View File

@@ -39,7 +39,6 @@ a:visited {
<ul>
<li><a href="download.html" target="MainFrame">Downloading / Unpacking</a>
<li><a href="install.html" target="MainFrame">Compiling / Installing</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
<li><a href="precompiled.html" target="MainFrame">Precompiled Libraries</a>
</ul>
@@ -68,6 +67,7 @@ a:visited {
<li><a href="repository.html" target="MainFrame">Source Code Repository</a>
<li><a href="memory.html" target="MainFrame">DRI Memory Management</a>
<li><a href="shading.html" target="MainFrame">Shading Language</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
<li><a href="utilities.html" target="MainFrame">Utilities</a>
<li><a href="helpwanted.html" target="MainFrame">Help Wanted</a>
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>

View File

@@ -123,48 +123,46 @@ These are the instructions for making a new Mesa release.
<H3>Get latest source files</H3>
<p>
Use "cvs update -dAP " to get the latest Mesa files from CVS.
Use git to get the latest Mesa files from the git repository, from whatever
branch is relevant.
</p>
<H3>Verify and update version info</H3>
<p>
Create/edit the docs/RELNOTES-X.Y file to document what's new in the release.
Add the new RELNOTES-X.Y file to <a href="relnotes.html">relnotes.html</a>.
Update the docs/VERSIONS file too.
Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>.
</p>
<p>
Edit the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
configs/default.
Also update the VERSION line in the top-level Makefile.
</p>
<p>
Make sure the values in src/mesa/main/version.h are correct.
</p>
<p>
Edit the top-level Makefile and verify that DIRECTORY, LIB_NAME and
DEMO_NAME are correct.
</p>
<p>
Update the docs/news.html file and docs/download.html files.
</p>
<p>
Check in all updates to CVS.
Check in all updates to git.
</p>
<p>
Tag the CVS files with the release name (in the form <b>mesa_X_Y</b>).
Tag the files with the release name (in the form <b>mesa_X_Y</b>)
with: <code>git tag -a mesa_X_Y</code>
Then: <code>git push origin mesa_X_Y</code>
</p>
<H3>Make the tarballs</H3>
<p>
Make a symbolic link from $(DIRECTORY) to 'Mesa'. For example,
ln -s Mesa Mesa-6.3
<code>ln -s Mesa Mesa-7.5</code>
This is needed in order to make a correct tar file in the next step.
</p>
@@ -177,7 +175,7 @@ Make the distribution files. From inside the Mesa directory:
<p>
After the tarballs are created, the md5 checksums for the files will
be computed.
Add them to the docs/news.html file.
Add them to the docs/relnotes-X.Y.html file.
</p>
<p>
@@ -191,9 +189,21 @@ Follow the directions on SourceForge for creating a new "release" and
uploading the tarballs.
</p>
<p>
Basically, to upload the tarball files with:
<br>
<code>
rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/
</code>
</p>
<p>
Update the web site by copying the docs/ directory's files to
/home/users/b/br/brianp/mesa-www/htdocs/
/home/users/b/br/brianp/mesa-www/htdocs/ with:
<br>
<code>
sftp USERNAME,mesa3d@web.sourceforge.net
</code>
</p>
<p>

View File

@@ -9,14 +9,14 @@
<H1>Downloading</H1>
<p>
Primary download site:
<a href="http://sourceforge.net/project/showfiles.php?group_id=3"
target="_parent">SourceForge</a>
Primary Mesa download site:
<a href="ftp://ftp.freedesktop.org/pub/mesa/"
target="_parent">freedesktop.org</a> (FTP)
</p>
<p>
When a new release is coming, release candidates (betas) can be found
<a href="http://www.mesa3d.org/beta/">here</a>.
When a new release is coming, release candidates (betas) may be found
<a href="ftp://ftp.freedesktop.org/pub/mesa/beta/" target="_parent">here</a>.
</p>

View File

@@ -316,6 +316,19 @@ Basically, applying a translation of (0.375, 0.375, 0.0) to your coordinates
will fix the problem.
</p>
<h2>3.6 How can I change the maximum framebuffer size in Mesa's
<tt>swrast</tt> backend?</h2>
<p>
These can be overridden by using the <tt>--with-max-width</tt> and
<tt>--with-max-height</tt> options. The two need not be equal.
</p><p>
Do note that Mesa uses these values to size some internal buffers,
so increasing these sizes will cause Mesa to require additional
memory. Furthermore, increasing these limits beyond <tt>4096</tt>
may introduce rasterization artifacts; see the leading comments in
<tt>src/mesa/swrast/s_tritemp.h</tt>.
</p>
<br>
<br>

View File

@@ -21,6 +21,7 @@
<li><a href="#pkg-config">Building OpenGL programs with pkg-config
</ul>
<li><a href="#windows">Windows</a>
<li><a href="#scons">SCons</a>
<li><a href="#other">Other</a>
</ol>
<br>
@@ -328,13 +329,60 @@ For example, compiling and linking a GLUT application can be done with:
<H2>2. Windows Compilation and Installation</H1>
<p>
Please see the <a href="README.WIN32">README.WIN32</a> file.
Please see the <a href="#scons">instructions on building with SCons</a>.
Alternatively see <a href="README.WIN32">README.WIN32</a> file.
</p>
<a name="scons">
<H2>3. Building with SCons</H1>
<p>
To build Mesa with SCons on Linux or Windows do
</p>
<pre>
scons
</pre>
<p>
The build output will be placed in
build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
by -debug for debug builds.
</p>
<p>
The sample programs are built seperately. To build them do
<pre>
scons -C progs
</pre>
And the build output will be placed in progs/build/...
</p>
<p>
To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
</p>
<pre>
scons platform=windows toolchain=crossmingw machine=x86 statetrackers=mesa drivers=softpipe,trace winsys=gdi
scons -C progs platform=windows toolchain=crossmingw machine=x86 -k
</pre>
<p>
This will create:
</p>
<ul>
<li>build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
<li>build/windows-x86-debug/glut/glx/glut32.dll
<li>progs/build/windows-x86-debug/wgl/wglinfo.exe
<li>progs/build/windows-x86-debug/trivial/tri.exe
<li>and many other samples in progs/build/windows-x86-debug/...
</ul>
<p>
Put them all in the same directory to test them.
</p>
<a name="other">
<H2>3. Other systems</H1>
<H2>4. Other systems</H1>
<p>
Documentation for other environments (some may be very out of date):

View File

@@ -11,6 +11,36 @@
<H1>News</H1>
<h2>September 3, 2009</h2>
<p>
<a href="relnotes-7.5.1.html">Mesa 7.5.1</a> is released.
This is a bug-fix release which fixes bugs found in version 7.5.
</p>
<h2>July 17, 2009</h2>
<p>
<a href="relnotes-7.5.html">Mesa 7.5</a> is released.
This is a new features release. People especially concerned about
stability may want to wait for the follow-on 7.5.1 bug-fix release.
</p>
<h2>June 23, 2009</h2>
<p>
<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released.
This is a stable release that fixes a regression in the i915/i965 drivers
that slipped into the 7.4.3 release.
</p>
<h2>June 19, 2009</h2>
<p>
<a href="relnotes-7.4.3.html">Mesa 7.4.3</a> is released.
This is a stable release fixing bugs since the 7.4.2 release.
</p>
<h2>May 15, 2009</h2>
<p>
<a href="relnotes-7.4.2.html">Mesa 7.4.2</a> is released.
@@ -84,7 +114,7 @@ Added a new page describing the <a href="cell.html">Mesa Cell driver</a>.
<p>
Gallium3D is the codename for the new Mesa device driver architecture
which is currently under development.
A <a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
A <a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent"> summary</a> of the architecture can be found on the
Tungsten Graphics website.
</p>

View File

@@ -9,17 +9,11 @@
<H1>Precompiled Libraries</H1>
<p>
In general, precompiled libraries are not available.
However, people occasionally prepare packages of precompiled libraries
for some systems.
In general, precompiled Mesa libraries are not available.
</p>
<H2>Mesa-6.0 for Solaris</H2>
<p>
Steve Christensen has submitted precompiled Mesa-6.0 libraries for
Solaris at <a href="http://sunfreeware.com/" target="_parent">
sunfreeware.com</a>.
However, some Linux distros (such as Ubuntu) seem to closely track
Mesa and often have the latest Mesa release available as an update.
</p>
</BODY>

79
docs/relnotes-7.4.3.html Normal file
View File

@@ -0,0 +1,79 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.4.3 Release Notes / 19 June 2009</H1>
<p>
Mesa 7.4.3 is a stable development release fixing bugs since the 7.4.2 release.
</p>
<p>
Mesa 7.4.3 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
34c5a6c47ed51f31c4fa36e269831352 MesaLib-7.4.3.tar.gz
70a983ba3deaa8bd63b18bbab283f698 MesaLib-7.4.3.tar.bz2
34f21b3205b271d575030aa98a2dda51 MesaLib-7.4.3.zip
56752b7adede212e6097afb10d0c0d59 MesaDemos-7.4.3.tar.gz
8ffa51c4833b1e298300a005e2d7ca2a MesaDemos-7.4.3.tar.bz2
0037d24d41400d6fb9800ae55b8c863f MesaDemos-7.4.3.zip
20e24f6692c0c90e7e3b220f79c4108d MesaGLUT-7.4.3.tar.gz
03a4beeef74fc5ef0b1d6d04710e5a8a MesaGLUT-7.4.3.tar.bz2
273788230adbdb9d57371309adedcf5f MesaGLUT-7.4.3.zip
</pre>
<h2>Bug fixes</h2>
<ul>
<li>Fixed texture object reference counting bug (bug 21756)
<li>Allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT point
(SF bug 2793846)
<li>Added missing glGet case for GL_VERTEX_ARRAY_BINDING_APPLE
<li>Fixed some OSMesa build issues
<li>Fixed a vertex buffer object crash
<li>Fixed broken glTexImage3D() when image type = GL_BITMAP
<li>Fixed some GLSL preprocessor bugs
<li>Fixed framebuffer mem leak in i945/i965 DRI drivers
<li>Fixed texture coordinate repeat bug in swrast (bug 21872)
<li>Fixed incorrect viewport clamping (lower bound is zero, not one)
<li>GLX fix for glean's makeCurrent test case
</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>

68
docs/relnotes-7.4.4.html Normal file
View File

@@ -0,0 +1,68 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.4.4 Release Notes / 23 June 2009</H1>
<p>
Mesa 7.4.4 is a stable development release fixing bugs since the 7.4.3 release.
</p>
<p>
Mesa 7.4.4 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
0b56fe5a88ab0c3c5b2da5068f63f416 MesaLib-7.4.4.tar.gz
b66528d314c574dccbe0ed963cac5e93 MesaLib-7.4.4.tar.bz2
2818076f3ba23fa87fdfe4602a637a18 MesaLib-7.4.4.zip
3e77b208386c47b18165bce5ae317e2c MesaDemos-7.4.4.tar.gz
628142ec9a54cd28cc027e6ce26cff47 MesaDemos-7.4.4.tar.bz2
d08a30d30ab7174859aa709cba6c726d MesaDemos-7.4.4.zip
e6e91ba16e274d40cf3a97ad3218af01 MesaGLUT-7.4.4.tar.gz
e14bbb52517e8121b31f1387515365ab MesaGLUT-7.4.4.tar.bz2
f10ed20469753c2b3d68c99854f80fd4 MesaGLUT-7.4.4.zip
</pre>
<h2>Bug fixes</h2>
<ul>
<li>Fixed i965/i915 segfault in screen destruction (bug 22408)
</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>

64
docs/relnotes-7.5.1.html Normal file
View File

@@ -0,0 +1,64 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.5.1 Release Notes, 3 September 2009</H1>
<p>
Mesa 7.5.1 is a bug-fix release fixing issues found since the 7.5 release.
</p>
<p>
The main new feature of Mesa 7.5.x is the
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
Mesa 7.5.1 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
</pre>
<h2>New features</h2>
<ul>
<li>Added configure --with-max-width=W, --with-max-height=H options to specify
max framebuffer, viewport size.
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Added missing GLEW library to MesaDemos tarballs.
<li>Fixed swapbuffers jerkiness in Doom3/etc in Intel drivers.
<li>Fixed front buffer rendering bug in Intel drivers.
<li>Fixed minor GLX memory leaks.
<li>Fixed some texture env / fragment program state bugs.
<li>Fixed some Gallium glBlitFramebuffer() bugs
<li>Empty glBegin/glEnd() pair could cause divide by zero (bug 23489)
<li>Fixed Gallium glBitmap() Z position bug
<li>Setting arrays of sampler uniforms did not work
<li>Selection/Feedback mode didn't handle polygon culling correctly (bug 16866)
<li>Fixed 32/64-bit cross compilation issue in gen_matypes.c
<li>Fixed glXCreateGLXPixmap() for direct rendering.
<li>Fixed Gallium glCopyPixels(GL_STENCIL_INDEX) mispositioned image bug.
</ul>
</body>
</html>

View File

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.5 Release Notes / date TBD</H1>
<H1>Mesa 7.5 Release Notes / 17 July 2009</H1>
<p>
Mesa 7.5 is a new development release.
@@ -17,7 +17,7 @@ with the 7.4.x branch or wait for Mesa 7.5.1.
</p>
<p>
The main new feature of Mesa 7.5 is the
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
target="_parent">Gallium3D</a> infrastructure.
</p>
<p>
@@ -40,13 +40,21 @@ If you're especially concerned with stability you should probably look for
<h2>MD5 checksums</h2>
<pre>
tbd
553fd956e544727f30fbe249619b6286 MesaLib-7.5.tar.gz
459f332551f6ebb86f384d21dd15e1f0 MesaLib-7.5.tar.bz2
8c02c0e17a9025250d20424ae32f5163 MesaLib-7.5.zip
a188da2886fa5496ea0c2cda602b2eeb MesaDemos-7.5.tar.gz
398ee8801814a00e47f6c2314e3dfddc MesaDemos-7.5.tar.bz2
15a0c8ae013c54335a26335e1a98d609 MesaDemos-7.5.zip
81010147def5a644ba14f9bbb7a49a2a MesaGLUT-7.5.tar.gz
baa7a1e850b6e39bae58868fd0684004 MesaGLUT-7.5.tar.bz2
265228418e4423fa328f2f5b7970cf08 MesaGLUT-7.5.zip
</pre>
<h2>New features</h2>
<ul>
<li>Gallium - this is the new architecture for OS-independent and
<li>Gallium3D - this is the new architecture for OS-independent and
API-independent 3D drivers.
Gallium3D is intended for GPUs that fully support vertex/fragment shaders.
The Gallium3D drivers currently included are:
@@ -54,8 +62,10 @@ tbd
<li>softpipe - a software/reference driver
<li>i915 - Intel 915/945 driver
<li><a href="cell.html">Cell</a> - IBM/Sony/Toshiba Cell processor driver
<li>nouveau - preliminary driver for NVIDIA GPUs (still under development)
<li>r300 - preliminary driver for R300 (still under development)
<li>nouveau (for NVIDIA GPUs) and R300 for (AMD/ATI R300).
<b>PLEASE NOTE: these drivers are incomplete and still under development.
It's probably NOT worthwhile to report any bugs unless you have patches.
</b>
</ul>
<li>GL_ARB_framebuffer_object extension (software drivers, i965 driver)
<li>Reworked two-sided stencil support.
@@ -66,12 +76,18 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
<li>GL_EXT_texture_swizzle extension (software drivers, i965 driver)
<li>Updated SPARC assembly optimizations (David S. Miller)
<li>Initial support for separate compilation units in GLSL compiler.
<li>Increased max number of generic GLSL varying variables to 16 (formerly 8).
<li>GLSL linker now detects when too many varying variables are used.
<li>Optimize-out redundant glMaterial and glShadeModel calls in display lists
<li>Fixed gl_TextureMatrix[i][j] array indexing bug in GLSL compiler.
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Lots of i965 driver bug fixes
<li>Fixed some GLSL preprocessor bugs
<li>GLSL: continue inside of a for-loop didn't work
</ul>

View File

@@ -8,18 +8,15 @@
<H1>Release Notes</H1>
<p>
Mesa uses an even/odd version number scheme like the Linux kernel.
Odd numbered versions (such as 6.5) designate new developmental releases.
Even numbered versions (such as 6.4) designate stable releases.
</p>
<p>
The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-7.5.1.html">7.5.1 release notes</A>
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A>
<LI><A HREF="relnotes-7.4.3.html">7.4.3 release notes</A>
<LI><A HREF="relnotes-7.4.2.html">7.4.2 release notes</A>
<LI><A HREF="relnotes-7.4.1.html">7.4.1 release notes</A>
<LI><A HREF="relnotes-7.4.html">7.4 release notes</A>

View File

@@ -2702,7 +2702,7 @@ typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers);
typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURLAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);
@@ -2723,7 +2723,7 @@ typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum targ
#define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers)
#define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers)
#define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer)
#define glFramebufferTexturLayer GLEW_GET_FUN(__glewFramebufferTexturLayer)
#define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer)
#define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D)
#define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D)
#define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D)
@@ -10563,7 +10563,7 @@ GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus;
GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers;
GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURLAYERPROC __glewFramebufferTexturLayer;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D;
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D;

View File

@@ -1,6 +1,7 @@
SConscript([
'util/SConscript',
'demos/SConscript',
'glsl/SConscript',
'redbook/SConscript',
'samples/SConscript',
'tests/SConscript',

View File

@@ -145,6 +145,13 @@ engine.o: engine.c trackball.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) engine.c
fbotexture: fbotexture.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) fbotexture.o $(LIBS) -o $@
fbotexture.o: fbotexture.c extfuncs.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) fbotexture.c
fslight: fslight.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) fslight.o $(LIBS) -o $@

View File

@@ -9,13 +9,13 @@
*/
#include <GL/glew.h>
#include <GL/glut.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "extfuncs.h"
/* For debug */
#define DEPTH 1
@@ -80,9 +80,9 @@ RenderTexture(void)
glTranslatef(0.0, 0.0, -15.0);
/* draw to texture image */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, MyFB);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf("Framebuffer incomplete!!!\n");
}
@@ -171,7 +171,7 @@ RenderTexture(void)
#if DRAW
/* Bind normal framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
#endif
CheckError(__LINE__);
@@ -252,12 +252,12 @@ static void
CleanUp(void)
{
#if DEPTH
glDeleteRenderbuffersEXT(1, &DepthRB);
glDeleteRenderbuffers_func(1, &DepthRB);
#endif
#if STENCIL
glDeleteRenderbuffersEXT(1, &StencilRB);
glDeleteRenderbuffers_func(1, &StencilRB);
#endif
glDeleteFramebuffersEXT(1, &MyFB);
glDeleteFramebuffers_func(1, &MyFB);
glDeleteTextures(1, &TexObj);
@@ -318,14 +318,14 @@ AttachDepthAndStencilBuffers(GLuint fbo,
*depthRbOut = *stencilRbOut = 0;
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fbo);
if (tryDepthStencil) {
GLuint rb;
glGenRenderbuffersEXT(1, &rb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_DEPTH24_STENCIL8_EXT,
width, height);
if (glGetError())
@@ -333,7 +333,7 @@ AttachDepthAndStencilBuffers(GLuint fbo,
if (bindDepthStencil) {
/* attach to both depth and stencil at once */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_STENCIL_ATTACHMENT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
@@ -341,21 +341,21 @@ AttachDepthAndStencilBuffers(GLuint fbo,
}
else {
/* attach to depth attachment point */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
/* and attach to stencil attachment point */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
}
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
return GL_FALSE;
@@ -367,22 +367,22 @@ AttachDepthAndStencilBuffers(GLuint fbo,
{
GLuint rb;
glGenRenderbuffersEXT(1, &rb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_DEPTH_COMPONENT,
width, height);
if (glGetError())
return GL_FALSE;
/* attach to depth attachment point */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
return GL_FALSE;
@@ -393,26 +393,26 @@ AttachDepthAndStencilBuffers(GLuint fbo,
{
GLuint rb;
glGenRenderbuffersEXT(1, &rb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_STENCIL_INDEX,
width, height);
if (glGetError())
return GL_FALSE;
/* attach to depth attachment point */
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
glDeleteRenderbuffersEXT(1, depthRbOut);
glDeleteRenderbuffers_func(1, depthRbOut);
*depthRbOut = 0;
glDeleteRenderbuffersEXT(1, &rb);
glDeleteRenderbuffers_func(1, &rb);
return GL_FALSE;
}
@@ -463,20 +463,51 @@ ParseArgs(int argc, char *argv[])
}
static void
SetupFunctionPointers(void)
{
GetExtensionFuncs();
if (Use_ARB_fbo) {
/* no-op: use the ARB functions as-is */
}
else {
/* set the ARB-flavor function pointers to point to the EXT functions */
glIsRenderbuffer_func = glIsRenderbufferEXT_func;
glBindRenderbuffer_func = glBindRenderbufferEXT_func;
glDeleteRenderbuffers_func = glDeleteRenderbuffersEXT_func;
glGenRenderbuffers_func = glGenRenderbuffersEXT_func;
glRenderbufferStorage_func = glRenderbufferStorageEXT_func;
glGetRenderbufferParameteriv_func = glGetRenderbufferParameterivEXT_func;
glIsFramebuffer_func = glIsFramebufferEXT_func;
glBindFramebuffer_func = glBindFramebufferEXT_func;
glDeleteFramebuffers_func = glDeleteFramebuffersEXT_func;
glGenFramebuffers_func = glGenFramebuffersEXT_func;
glCheckFramebufferStatus_func = glCheckFramebufferStatusEXT_func;
glFramebufferTexture1D_func = glFramebufferTexture1DEXT_func;
glFramebufferTexture2D_func = glFramebufferTexture2DEXT_func;
glFramebufferTexture3D_func = glFramebufferTexture3DEXT_func;
glFramebufferRenderbuffer_func = glFramebufferRenderbufferEXT_func;
glGetFramebufferAttachmentParameteriv_func = glGetFramebufferAttachmentParameterivEXT_func;
glGenerateMipmap_func = glGenerateMipmapEXT_func;
}
}
/*
* Make FBO to render into given texture.
*/
static GLuint
MakeFBO_RenderTexture(GLuint TexObj)
MakeFBO_RenderTexture(GLuint texObj)
{
GLuint fb;
GLint sizeFudge = 0;
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glGenFramebuffers_func(1, &fb);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fb);
/* Render color to texture */
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
TexTarget, TexObj, TextureLevel);
glFramebufferTexture2D_func(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
TexTarget, texObj, TextureLevel);
if (Use_ARB_fbo) {
/* use a smaller depth buffer to see what happens */
@@ -510,28 +541,48 @@ MakeFBO_RenderTexture(GLuint TexObj)
/* queries */
{
GLint bits, w, h;
GLint bits, w, h, name;
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, DepthRB);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_WIDTH_EXT, &w);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_HEIGHT_EXT, &h);
printf("Color/Texture size: %d x %d\n", TexWidth, TexHeight);
printf("Depth buffer size: %d x %d\n", w, h);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_DEPTH_SIZE_EXT, &bits);
printf("Depth renderbuffer size = %d bits\n", bits);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, StencilRB);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits);
printf("Stencil renderbuffer size = %d bits\n", bits);
}
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Render to texture name: %d\n", texObj);
printf("Color attachment[0] name: %d\n", name);
assert(texObj == name);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Stencil attachment name: %d\n", name);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Depth attachment name: %d\n", name);
}
/* bind the regular framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
return fb;
}
@@ -547,6 +598,8 @@ Init(void)
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
SetupFunctionPointers();
/* lighting */
{
static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 };
@@ -605,7 +658,6 @@ main(int argc, char *argv[])
glutInitWindowSize(Width, Height);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Display);

View File

@@ -583,10 +583,14 @@ ParseOptions(int argc, char *argv[])
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-fs") == 0) {
FragProgFile = argv[i+1];
FragProgFile = argv[++i];
}
else if (strcmp(argv[i], "-vs") == 0) {
VertProgFile = argv[i+1];
VertProgFile = argv[++i];
}
else {
fprintf(stderr, "unknown option %s\n", argv[i]);
break;
}
}
}

View File

@@ -514,12 +514,27 @@ static void draw_surface( unsigned int with_state )
break;
case (GLVERTEX|STRIPS):
glBegin( GL_TRIANGLE_STRIP );
for (i=0;i<numverts;i++) {
glNormal3fv( &data[i][3] );
glVertex3fv( &data[i][0] );
if (with_state & MATERIALS) {
glBegin( GL_TRIANGLE_STRIP );
for (i=0;i<numverts;i++) {
if (i % 600 == 0 && i != 0) {
unsigned j = i / 600;
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]);
}
glNormal3fv( &data[i][3] );
glVertex3fv( &data[i][0] );
}
glEnd();
}
else {
glBegin( GL_TRIANGLE_STRIP );
for (i=0;i<numverts;i++) {
glNormal3fv( &data[i][3] );
glVertex3fv( &data[i][0] );
}
glEnd();
}
glEnd();
break;
default:

View File

@@ -11,7 +11,20 @@ env.Prepend(CPPPATH = [
env.Prepend(LIBS = ['$GLUT_LIB'])
env.Program(
target = 'fp-tri',
source = ['fp-tri.c'],
progs = [
'fp-tri',
'tri-depth',
'tri-depth2',
'tri-depthwrite',
'tri-depthwrite2',
'tri-inv',
'tri-param',
'tri-tex',
'point-position',
]
for prog in progs:
env.Program(
target = prog,
source = [prog + '.c'],
)

View File

@@ -89,7 +89,7 @@ static void Init( void )
}
fprintf(stderr, "%.*s\n", sz, buf);
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}

View File

@@ -2,9 +2,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "GL/gl.h"
@@ -17,7 +16,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -109,6 +108,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,9 +2,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "GL/gl.h"
@@ -19,7 +18,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -89,8 +88,6 @@ int main(int argc, char **argv)
glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB;
@@ -101,6 +98,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,9 +2,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "GL/gl.h"
@@ -21,7 +20,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -106,6 +105,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
@@ -16,7 +16,7 @@ static void Init(void)
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
@@ -16,7 +16,7 @@ static void Init(void)
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
@@ -17,7 +17,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -99,6 +99,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -2,9 +2,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "GL/gl.h"
static void Init( void )
{
@@ -15,7 +15,7 @@ static void Init( void )
;
GLuint modulateProg;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -104,6 +104,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.c"
@@ -23,7 +23,7 @@ static void Init( void )
GLuint modulateProg;
GLuint Texture;
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
if (!GLEW_ARB_fragment_program) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
@@ -120,6 +120,8 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);

View File

@@ -10,7 +10,7 @@ LIB_DEP = \
$(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$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
INCLUDE_DIRS = -I$(TOP)/progs/util
@@ -32,6 +32,7 @@ DEMO_SOURCES = \
pointcoord.c \
points.c \
samplers.c \
samplers_array.c \
shadow_sampler.c \
skinning.c \
texaaline.c \
@@ -80,25 +81,26 @@ clean:
-rm -f *.o *~
-rm -f extfuncs.h
-rm -f shaderutil.*
-rm -f readtex.*
##### Extra dependencies
extfuncs.h:
cp $(TOP)/progs/util/extfuncs.h .
extfuncs.h: $(TOP)/progs/util/extfuncs.h
cp $< .
readtex.c:
cp $(TOP)/progs/util/readtex.c .
readtex.c: $(TOP)/progs/util/readtex.c
cp $< .
readtex.h:
cp $(TOP)/progs/util/readtex.h .
readtex.h: $(TOP)/progs/util/readtex.h
cp $< .
shaderutil.c:
cp $(TOP)/progs/util/shaderutil.c .
shaderutil.c: $(TOP)/progs/util/shaderutil.c
cp $< .
shaderutil.h:
cp $(TOP)/progs/util/shaderutil.h .
shaderutil.h: $(TOP)/progs/util/shaderutil.h
cp $< .
@@ -187,7 +189,8 @@ samplers.o: $(UTIL_HEADERS)
samplers: samplers.o $(UTIL_OBJS)
samplers_array.o: $(UTIL_HEADERS)
samplers_array.o: samplers.c $(UTIL_HEADERS)
$(APP_CC) $(CFLAGS) -DSAMPLERS_ARRAY $< -c -o $@
samplers_array: samplers_array.o $(UTIL_OBJS)

55
progs/glsl/SConscript Normal file
View File

@@ -0,0 +1,55 @@
Import('*')
if not env['GLUT']:
Return()
env = env.Clone()
env.Prepend(CPPPATH = [
'../util',
])
env.Prepend(LIBS = [
util,
'$GLUT_LIB'
])
if env['platform'] == 'windows':
env.Append(CPPDEFINES = ['NOMINMAX'])
env.Prepend(LIBS = ['winmm'])
progs = [
'array',
'bitmap',
'brick',
'bump',
'convolutions',
'deriv',
'fragcoord',
'identity',
'linktest',
'mandelbrot',
'multinoise',
'multitex',
'noise',
'noise2',
'pointcoord',
'points',
'samplers',
'shadow_sampler',
'skinning',
'texaaline',
'texdemo1',
'toyball',
'trirast',
'twoside',
'vert-or-frag-only',
'vert-tex',
]
for prog in progs:
env.Program(
target = prog,
source = prog + '.c',
)

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -144,9 +142,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -219,19 +217,17 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/* Setup the HeightArray[] uniform */
for (i = 0; i < 20; i++)
HeightArray[i] = i / 20.0;
u = glGetUniformLocation_func(program, "HeightArray");
glUniform1fv_func(u, 20, HeightArray);
u = glGetUniformLocation(program, "HeightArray");
glUniform1fv(u, 20, HeightArray);
assert(glGetError() == 0);
@@ -248,6 +244,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -78,11 +76,11 @@ Redisplay(void)
BitmapText("-X");
}
else {
glUseProgram_func(Program);
glUseProgram(Program);
/* vertex positions (deltas) depend on texture size and window size */
if (uScale != -1) {
glUniform2f_func(uScale,
glUniform2f(uScale,
2.0 * TEX_WIDTH / WinWidth,
2.0 * TEX_HEIGHT / WinHeight);
}
@@ -105,7 +103,7 @@ Redisplay(void)
glTexCoord2f(0, 1); glVertex3fv(nx);
glEnd();
glUseProgram_func(0);
glUseProgram(0);
}
glPopMatrix();
@@ -160,9 +158,9 @@ Key(unsigned char key, int x, int y)
printf("Using billboard texture\n");
break;
case 27:
glDeleteShader_func(FragShader);
glDeleteShader_func(VertShader);
glDeleteProgram_func(Program);
glDeleteShader(FragShader);
glDeleteShader(VertShader);
glDeleteProgram(Program);
glutDestroyWindow(Win);
exit(0);
}
@@ -277,21 +275,19 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
Program = LinkShaders(VertShader, FragShader);
glUseProgram_func(Program);
glUseProgram(Program);
uScale = glGetUniformLocation_func(Program, "scale");
uTex = glGetUniformLocation_func(Program, "tex2d");
uScale = glGetUniformLocation(Program, "scale");
uTex = glGetUniformLocation(Program, "tex2d");
if (uTex != -1) {
glUniform1i_func(uTex, 0); /* tex unit 0 */
glUniform1i(uTex, 0); /* tex unit 0 */
}
glUseProgram_func(0);
glUseProgram(0);
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
@@ -309,6 +305,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -82,9 +80,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -144,13 +142,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, Uniforms);
@@ -160,9 +156,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -191,6 +187,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glu.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -60,7 +58,7 @@ static void
Square(GLfloat size)
{
glNormal3f(0, 0, 1);
glVertexAttrib3f_func(tangentAttrib, 1, 0, 0);
glVertexAttrib3f(tangentAttrib, 1, 0, 0);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-size, -size);
glTexCoord2f(1, 0); glVertex2f( size, -size);
@@ -164,9 +162,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -230,17 +228,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
assert(glGetError() == 0);
@@ -250,7 +246,7 @@ Init(void)
CheckError(__LINE__);
tangentAttrib = glGetAttribLocation_func(program, "Tangent");
tangentAttrib = glGetAttribLocation(program, "Tangent");
printf("Tangent Attrib: %d\n", tangentAttrib);
assert(tangentAttrib >= 0);
@@ -288,6 +284,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -5,6 +5,8 @@
* Author: Zack Rusin
*/
#include <GL/glew.h>
#define GL_GLEXT_PROTOTYPES
#include "readtex.h"
@@ -455,6 +457,7 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
init();
glutReshapeFunc(reshape);

View File

@@ -13,10 +13,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -70,9 +68,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -177,13 +175,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -197,9 +193,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -228,6 +224,7 @@ main(int argc, char *argv[])
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -12,10 +12,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -85,9 +83,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -129,13 +127,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -143,9 +139,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -174,6 +170,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -69,9 +67,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -141,8 +139,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
if (FragProgFile)
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
else
@@ -155,7 +151,7 @@ Init(void)
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
/*assert(glGetError() == 0);*/
@@ -164,9 +160,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -195,6 +191,7 @@ main(int argc, char *argv[])
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -132,11 +130,11 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(VertShader1);
glDeleteShader_func(VertShader2);
glDeleteShader_func(FragShader1);
glDeleteShader_func(FragShader2);
glDeleteProgram_func(Program);
glDeleteShader(VertShader1);
glDeleteShader(VertShader2);
glDeleteShader(FragShader1);
glDeleteShader(FragShader2);
glDeleteProgram(Program);
glutDestroyWindow(Win);
}
@@ -175,11 +173,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
@@ -191,8 +189,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1);
@@ -200,26 +196,26 @@ Init(void)
FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1);
FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2);
Program = glCreateProgram_func();
glAttachShader_func(Program, VertShader1);
glAttachShader_func(Program, VertShader2);
glAttachShader_func(Program, FragShader1);
glAttachShader_func(Program, FragShader2);
Program = glCreateProgram();
glAttachShader(Program, VertShader1);
glAttachShader(Program, VertShader2);
glAttachShader(Program, FragShader1);
glAttachShader(Program, FragShader2);
glLinkProgram_func(Program);
glLinkProgram(Program);
CheckLink(Program);
glUseProgram_func(Program);
glUseProgram(Program);
uDiffuse = glGetUniformLocation_func(Program, "diffuse");
uSpecular = glGetUniformLocation_func(Program, "specular");
uTexture = glGetUniformLocation_func(Program, "texture");
uDiffuse = glGetUniformLocation(Program, "diffuse");
uSpecular = glGetUniformLocation(Program, "specular");
uTexture = glGetUniformLocation(Program, "texture");
printf("DiffusePos %d SpecularPos %d TexturePos %d\n",
uDiffuse, uSpecular, uTexture);
glUniform4fv_func(uDiffuse, 1, diffuse);
glUniform4fv_func(uSpecular, 1, specular);
glUniform4fv(uDiffuse, 1, diffuse);
glUniform4fv(uSpecular, 1, specular);
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
@@ -228,11 +224,11 @@ Init(void)
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f);
assert(glIsProgram_func(Program));
assert(glIsShader_func(VertShader1));
assert(glIsShader_func(VertShader2));
assert(glIsShader_func(FragShader1));
assert(glIsShader_func(FragShader2));
assert(glIsProgram(Program));
assert(glIsShader(VertShader1));
assert(glIsShader(VertShader2));
assert(glIsShader(FragShader1));
assert(glIsShader(FragShader2));
glColor3f(1, 0, 0);
}
@@ -245,6 +241,7 @@ main(int argc, char *argv[])
glutInitWindowSize(300, 300);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -56,9 +54,9 @@ Redisplay(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* set interactive uniform parameters */
glUniform1fv_func(uZoom, 1, &zoom);
glUniform1fv_func(uXcenter, 1, &xCenter);
glUniform1fv_func(uYcenter, 1, &yCenter);
glUniform1fv(uZoom, 1, &zoom);
glUniform1fv(uXcenter, 1, &xCenter);
glUniform1fv(uYcenter, 1, &yCenter);
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
@@ -94,9 +92,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -155,19 +153,17 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, Uniforms);
uZoom = glGetUniformLocation_func(program, "Zoom");
uXcenter = glGetUniformLocation_func(program, "Xcenter");
uYcenter = glGetUniformLocation_func(program, "Ycenter");
uZoom = glGetUniformLocation(program, "Zoom");
uXcenter = glGetUniformLocation(program, "Xcenter");
uYcenter = glGetUniformLocation(program, "Ycenter");
assert(glGetError() == 0);
@@ -175,9 +171,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -206,6 +202,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -8,10 +8,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
static const char *VertShaderText =
"void main() {\n"
@@ -107,10 +105,10 @@ CleanUp(void)
{
GLint i;
glDeleteShader_func(vertShader);
glDeleteShader(vertShader);
for( i = 0; i < 4; i++ ) {
glDeleteShader_func(fragShader[ i ]);
glDeleteProgram_func(program[ i ]);
glDeleteShader(fragShader[ i ]);
glDeleteProgram(program[ i ]);
}
glutDestroyWindow(win);
}
@@ -143,7 +141,7 @@ Key(unsigned char key, int x, int y)
case '2':
case '3':
case '4':
glUseProgram_func(program[ key - '1' ]);
glUseProgram(program[ key - '1' ]);
break;
case 27:
CleanUp();
@@ -186,15 +184,15 @@ LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glCompileShader(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "noise: problem compiling shader: %s\n", log);
exit(1);
}
@@ -208,11 +206,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
@@ -233,22 +231,20 @@ Init(void)
/*exit(1);*/
}
GetExtensionFuncs();
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
vertShader = glCreateShader(GL_VERTEX_SHADER);
LoadAndCompileShader(vertShader, VertShaderText);
for( i = 0; i < 4; i++ ) {
fragShader[ i ] = glCreateShader_func(GL_FRAGMENT_SHADER);
fragShader[ i ] = glCreateShader(GL_FRAGMENT_SHADER);
LoadAndCompileShader(fragShader[ i ], FragShaderText[ i ]);
program[ i ] = glCreateProgram_func();
glAttachShader_func(program[ i ], fragShader[ i ]);
glAttachShader_func(program[ i ], vertShader);
glLinkProgram_func(program[ i ]);
program[ i ] = glCreateProgram();
glAttachShader(program[ i ], fragShader[ i ]);
glAttachShader(program[ i ], vertShader);
glLinkProgram(program[ i ]);
CheckLink(program[ i ]);
}
glUseProgram_func(program[ 0 ]);
glUseProgram(program[ 0 ]);
assert(glGetError() == 0);
@@ -270,6 +266,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -28,9 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "multitex";
@@ -80,22 +80,22 @@ static void
DrawPolygonArray(void)
{
if (VertCoord_attr >= 0) {
glVertexAttribPointer_func(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
glVertexAttribPointer(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
0, VertCoords);
glEnableVertexAttribArray_func(VertCoord_attr);
glEnableVertexAttribArray(VertCoord_attr);
}
else {
glVertexPointer(2, GL_FLOAT, 0, VertCoords);
glEnable(GL_VERTEX_ARRAY);
}
glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
glVertexAttribPointer(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
0, Tex0Coords);
glEnableVertexAttribArray_func(TexCoord0_attr);
glEnableVertexAttribArray(TexCoord0_attr);
glVertexAttribPointer_func(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
glVertexAttribPointer(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
0, Tex1Coords);
glEnableVertexAttribArray_func(TexCoord1_attr);
glEnableVertexAttribArray(TexCoord1_attr);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
@@ -109,11 +109,11 @@ DrawPolygonVert(void)
glBegin(GL_TRIANGLE_FAN);
for (i = 0; i < 4; i++) {
glVertexAttrib2fv_func(TexCoord0_attr, Tex0Coords[i]);
glVertexAttrib2fv_func(TexCoord1_attr, Tex1Coords[i]);
glVertexAttrib2fv(TexCoord0_attr, Tex0Coords[i]);
glVertexAttrib2fv(TexCoord1_attr, Tex1Coords[i]);
if (VertCoord_attr >= 0)
glVertexAttrib2fv_func(VertCoord_attr, VertCoords[i]);
glVertexAttrib2fv(VertCoord_attr, VertCoords[i]);
else
glVertex2fv(VertCoords[i]);
}
@@ -267,13 +267,28 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, uniforms);
TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
VertCoord_attr = glGetAttribLocation(program, "VertCoord");
if (VertCoord_attr > 0) {
/* We want the VertCoord attrib to have position zero so that
* the call to glVertexAttrib(0, xyz) triggers vertex processing.
* Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have
* to set that attribute last (which is a PITA to manage).
*/
glBindAttribLocation(program, 0, "VertCoord");
/* re-link */
glLinkProgram(program);
/* VertCoord_attr should be zero now */
VertCoord_attr = glGetAttribLocation(program, "VertCoord");
assert(VertCoord_attr == 0);
}
TexCoord0_attr = glGetAttribLocation(program, "TexCoord0");
TexCoord1_attr = glGetAttribLocation(program, "TexCoord1");
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
printf("VertCoord_attr = %d\n", VertCoord_attr);
@@ -300,8 +315,6 @@ InitGL(void)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
InitTextures();
InitPrograms();
@@ -319,6 +332,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow(Demo);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);

View File

@@ -8,10 +8,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -67,7 +65,7 @@ Redisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUniform1fv_func(Uniforms[2].location, 1, &Slice);
glUniform1fv(Uniforms[2].location, 1, &Slice);
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
@@ -103,9 +101,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -175,13 +173,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, Uniforms);
@@ -191,9 +187,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -207,6 +203,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -10,10 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -64,9 +62,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -141,18 +139,16 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
tex0 = glGetUniformLocation_func(program, "tex0");
tex0 = glGetUniformLocation(program, "tex0");
printf("Uniforms: tex0: %d\n", tex0);
glUniform1i_func(tex0, 0); /* tex unit 0 */
glUniform1i(tex0, 0); /* tex unit 0 */
/*assert(glGetError() == 0);*/
@@ -160,9 +156,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
MakeTexture();
@@ -195,6 +191,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -10,10 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -99,7 +97,7 @@ Redisplay(void)
*/
glPushMatrix();
glTranslatef(0, 1.2, 0);
glUseProgram_func(0);
glUseProgram(0);
DrawPoints(GL_FALSE);
glPopMatrix();
@@ -108,9 +106,9 @@ Redisplay(void)
*/
glPushMatrix();
glTranslatef(0, -1.2, 0);
glUseProgram_func(Program);
glUseProgram(Program);
if (uViewportInv != -1) {
glUniform2f_func(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
glUniform2f(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
}
DrawPoints(GL_TRUE);
glPopMatrix();
@@ -150,9 +148,9 @@ Key(unsigned char key, int x, int y)
Smooth = !Smooth;
break;
case 27:
glDeleteShader_func(FragShader);
glDeleteShader_func(VertShader);
glDeleteProgram_func(Program);
glDeleteShader(FragShader);
glDeleteShader(VertShader);
glDeleteProgram(Program);
glutDestroyWindow(Win);
exit(0);
}
@@ -225,17 +223,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
Program = LinkShaders(VertShader, FragShader);
glUseProgram_func(Program);
glUseProgram(Program);
uViewportInv = glGetUniformLocation_func(Program, "viewportInv");
uViewportInv = glGetUniformLocation(Program, "viewportInv");
glUseProgram_func(0);
glUseProgram(0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
@@ -248,6 +244,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -11,6 +11,7 @@ void main()
float two_n_dot_u = 2.0 * dot(n, u);
vec4 f;
f.xyz = u - n * two_n_dot_u;
f.w = 1.0;
// outputs
normal = n;

View File

@@ -39,9 +39,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
@@ -211,10 +211,18 @@ InitTextures(void)
for (y = 0; y < stripeSize; y++) {
for (x = 0; x < size; x++) {
GLint k = 4 * ((ypos + y) * size + x);
texImage[k + 0] = intensity;
texImage[k + 1] = intensity;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
if (x < size / 2) {
texImage[k + 0] = intensity;
texImage[k + 1] = intensity;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
}
else {
texImage[k + 0] = 255 - intensity;
texImage[k + 1] = 0;
texImage[k + 2] = 0;
texImage[k + 3] = 255;
}
}
}
@@ -290,7 +298,7 @@ CreateProgram(void)
assert(vertShader);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
free(fragShaderText);
@@ -315,10 +323,10 @@ InitProgram(void)
#else
sprintf(uname, "tex[%d]", s);
#endif
loc = glGetUniformLocation_func(Program, uname);
loc = glGetUniformLocation(Program, uname);
assert(loc >= 0);
glUniform1i_func(loc, s);
glUniform1i(loc, s);
}
}
@@ -333,8 +341,6 @@ InitGL(void)
printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &NumSamplers);
if (NumSamplers > MAX_SAMPLERS)
NumSamplers = MAX_SAMPLERS;
@@ -357,6 +363,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow(Demo);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);

View File

@@ -10,10 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
/** Use GL_RECTANGLE texture (with projective texcoords)? */
@@ -66,7 +64,7 @@ Redisplay(void)
glPushMatrix();
CheckError(__LINE__);
glUseProgram_func(program);
glUseProgram(program);
CheckError(__LINE__);
glBegin(GL_POLYGON);
@@ -86,7 +84,7 @@ Redisplay(void)
glPopMatrix();
glUseProgram_func(0);
glUseProgram(0);
glWindowPos2iARB(80, 20);
PrintString("white black white black");
@@ -110,9 +108,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -178,13 +176,13 @@ 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);
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
glCompileShader(shader);
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
exit(1);
}
@@ -222,11 +220,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
@@ -266,35 +264,33 @@ Init(void)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
fragShader = glCreateShader(GL_FRAGMENT_SHADER);
if (FragProgFile)
ReadShader(fragShader, FragProgFile);
else
LoadAndCompileShader(fragShader, fragShaderText);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
vertShader = glCreateShader(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);
program = glCreateProgram();
glAttachShader(program, fragShader);
glAttachShader(program, vertShader);
glLinkProgram(program);
CheckLink(program);
glUseProgram_func(program);
glUseProgram(program);
uTexture2D = glGetUniformLocation_func(program, "shadowTex2D");
uTextureRect = glGetUniformLocation_func(program, "shadowTexRect");
uTexture2D = glGetUniformLocation(program, "shadowTex2D");
uTextureRect = glGetUniformLocation(program, "shadowTexRect");
printf("uTexture2D %d uTextureRect %d\n", uTexture2D, uTextureRect);
if (uTexture2D >= 0) {
glUniform1i_func(uTexture2D, 0); /* use texture unit 0 */
glUniform1i(uTexture2D, 0); /* use texture unit 0 */
}
if (uTextureRect >= 0) {
glUniform1i_func(uTextureRect, 1); /* use texture unit 0 */
glUniform1i(uTextureRect, 1); /* use texture unit 0 */
}
CheckError(__LINE__);
@@ -329,6 +325,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 300);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -12,10 +12,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -64,11 +62,11 @@ Cylinder(GLfloat length, GLfloat radius, GLint slices, GLint stacks)
float a = (float) i / (slices - 1) * M_PI * 2.0;
float x = radius * cos(a);
float y = radius * sin(a);
glVertexAttrib1f_func(WeightAttr, w0);
glVertexAttrib1f(WeightAttr, w0);
glNormal3f(x, y, 0.0);
glVertex3f(x, y, z0);
glVertexAttrib1f_func(WeightAttr, w0 + dw);
glVertexAttrib1f(WeightAttr, w0 + dw);
glNormal3f(x, y, 0.0);
glVertex3f(x, y, z0 + dz);
}
@@ -106,8 +104,8 @@ Redisplay(void)
{
UpdateMatrices();
glUniformMatrix4fv_func(uMat0, 1, GL_FALSE, Matrices[0]);
glUniformMatrix4fv_func(uMat1, 1, GL_FALSE, Matrices[1]);
glUniformMatrix4fv(uMat0, 1, GL_FALSE, Matrices[0]);
glUniformMatrix4fv(uMat1, 1, GL_FALSE, Matrices[1]);
if (WireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -148,9 +146,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -221,18 +219,16 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
uMat0 = glGetUniformLocation_func(program, "mat0");
uMat1 = glGetUniformLocation_func(program, "mat1");
uMat0 = glGetUniformLocation(program, "mat0");
uMat1 = glGetUniformLocation(program, "mat1");
WeightAttr = glGetAttribLocation_func(program, "weight");
WeightAttr = glGetAttribLocation(program, "weight");
assert(glGetError() == 0);
@@ -266,6 +262,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -11,10 +11,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
static GLint WinWidth = 300, WinHeight = 300;
@@ -328,8 +326,6 @@ Init(void)
exit(1);
}
GetExtensionFuncs();
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
@@ -359,6 +355,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -28,9 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#include "extfuncs.h"
#include "shaderutil.h"
static const char *Demo = "texdemo1";
@@ -97,7 +97,7 @@ draw(void)
/* sphere w/ reflection map */
glPushMatrix();
glTranslatef(0, 1, 0);
glUseProgram_func(Program1);
glUseProgram(Program1);
/* setup texture matrix */
glActiveTexture(GL_TEXTURE0);
@@ -116,7 +116,7 @@ draw(void)
glPopMatrix();
/* ground */
glUseProgram_func(Program2);
glUseProgram(Program2);
glTranslatef(0, -1.0, 0);
DrawGround(5);
@@ -380,7 +380,7 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, uniforms);
@@ -407,8 +407,6 @@ Init(GLboolean useImageFiles)
}
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
GetExtensionFuncs();
InitTextures(useImageFiles);
InitPrograms();
@@ -426,6 +424,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
win = glutCreateWindow(Demo);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(key);
glutSpecialFunc(specialkey);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -99,9 +97,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -169,13 +167,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
InitUniforms(program, Uniforms);
@@ -212,6 +208,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -15,10 +15,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -85,9 +83,9 @@ Redisplay(void)
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]);
glUniform2fv(uv0, 1, v[0]);
glUniform2fv(uv1, 1, v[1]);
glUniform2fv(uv2, 1, v[2]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -132,9 +130,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -196,17 +194,15 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
uv0 = glGetUniformLocation_func(program, "v0");
uv1 = glGetUniformLocation_func(program, "v1");
uv2 = glGetUniformLocation_func(program, "v2");
uv0 = glGetUniformLocation(program, "v0");
uv1 = glGetUniformLocation(program, "v1");
uv2 = glGetUniformLocation(program, "v2");
printf("Uniforms: %d %d %d\n", uv0, uv1, uv2);
/*assert(glGetError() == 0);*/
@@ -216,9 +212,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glColor3f(1, 0, 0);
}
@@ -247,6 +243,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -12,10 +12,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -59,11 +57,11 @@ Redisplay(void)
glFrontFace(FrontWinding);
if (DetermineFacingInFragProg) {
glUniform1i_func(u_fragface, 1);
glUniform1i(u_fragface, 1);
glDisable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
else {
glUniform1i_func(u_fragface, 0);
glUniform1i(u_fragface, 0);
glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
@@ -75,7 +73,7 @@ Redisplay(void)
/* Draw a tristrip ring */
glBegin(GL_TRIANGLE_STRIP);
glColor4fv(Red);
glSecondaryColor3fv_func(Green);
glSecondaryColor3fv(Green);
for (i = 0; i <= sections; i++) {
float a = (float) i / (sections) * M_PI * 2.0;
float x = radius * cos(a);
@@ -125,9 +123,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -229,15 +227,13 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
u_fragface = glGetUniformLocation_func(program, "fragface");
u_fragface = glGetUniformLocation(program, "fragface");
printf("Uniforms: %d\n", u_fragface);
/*assert(glGetError() == 0);*/
@@ -246,9 +242,9 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
assert(glIsProgram(program));
assert(glIsShader(fragShader));
assert(glIsShader(vertShader));
glEnable(GL_DEPTH_TEST);
@@ -293,6 +289,7 @@ main(int argc, char *argv[])
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -11,10 +11,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -58,14 +56,14 @@ Redisplay(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* render with vertex shader only */
glUseProgram_func(VertProgram);
glUseProgram(VertProgram);
glPushMatrix();
glTranslatef(-1.5, 0, 0);
DrawQuadTex();
glPopMatrix();
/* render with fragment shader only */
glUseProgram_func(FragProgram);
glUseProgram(FragProgram);
glPushMatrix();
glTranslatef(+1.5, 0, 0);
DrawQuadColor();
@@ -90,10 +88,10 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(FragShader);
glDeleteShader_func(VertShader);
glDeleteProgram_func(VertProgram);
glDeleteProgram_func(FragProgram);
glDeleteShader(FragShader);
glDeleteShader(VertShader);
glDeleteProgram(VertProgram);
glDeleteProgram(FragProgram);
glutDestroyWindow(Win);
}
@@ -129,8 +127,6 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
if (FragProgFile)
FragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
else
@@ -149,10 +145,10 @@ Init(void)
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
assert(glIsProgram_func(VertProgram));
assert(glIsProgram_func(FragProgram));
assert(glIsShader_func(FragShader));
assert(glIsShader_func(VertShader));
assert(glIsProgram(VertProgram));
assert(glIsProgram(FragProgram));
assert(glIsShader(FragShader));
assert(glIsShader(VertShader));
glColor3f(1, 0, 0);
}
@@ -181,6 +177,7 @@ main(int argc, char *argv[])
glutInitWindowSize(400, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Redisplay);

View File

@@ -9,10 +9,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -133,9 +131,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glDeleteShader(fragShader);
glDeleteShader(vertShader);
glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -239,13 +237,11 @@ Init(void)
if (!ShadersSupported())
exit(1);
GetExtensionFuncs();
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
program = LinkShaders(vertShader, fragShader);
glUseProgram_func(program);
glUseProgram(program);
assert(glGetError() == 0);
@@ -266,6 +262,7 @@ main(int argc, char *argv[])
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);

View File

@@ -5,6 +5,7 @@ arbfpspec
arbfptest1
arbfptexture
arbfptrig
arbgpuprog
arbnpot
arbnpot-mipmap
arbvptest1
@@ -38,6 +39,7 @@ fptest1
fptexture
getprocaddress
getproclist.h
getteximage
glutfx
interleave
invert
@@ -49,12 +51,15 @@ mapvbo
minmag
mipgen
mipmap_comp
mipmap_comp_tests
mipmap_limits
mipmap_view
multipal
no_s3tc
packedpixels
persp_hint
pbo
prim
prog_parameter
quads
random
@@ -62,6 +67,8 @@ readrate
readtex.c
readtex.h
rubberband
scissor
scissor-viewport
seccolor
shader_api
shaderutil.c
@@ -75,6 +82,7 @@ subtex
subtexrate
tex1d
texcompress2
texcompsub
texdown
texfilt
texline

View File

@@ -59,6 +59,7 @@ SOURCES = \
minmag.c \
mipgen.c \
mipmap_comp.c \
mipmap_comp_tests.c \
mipmap_limits.c \
mipmap_view.c \
multipal.c \
@@ -70,6 +71,8 @@ SOURCES = \
random.c \
readrate.c \
rubberband.c \
scissor.c \
scissor-viewport.c \
seccolor.c \
shader_api.c \
sharedtex.c \
@@ -81,6 +84,7 @@ SOURCES = \
subtexrate.c \
tex1d.c \
texcompress2.c \
texcompsub.c \
texdown \
texfilt.c \
texline.c \

View File

@@ -82,6 +82,7 @@ progs = [
'minmag',
'mipgen',
'mipmap_comp',
'mipmap_comp_tests',
'mipmap_limits',
'mipmap_view',
'multipal',
@@ -95,6 +96,8 @@ progs = [
'random',
'readrate',
'rubberband',
'scissor',
'scissor-viewport',
'seccolor',
'shader_api',
'stencil_twoside',
@@ -106,6 +109,7 @@ progs = [
'tex1d',
'texcmp',
'texcompress2',
'texcompsub',
'texdown',
'texfilt',
'texgenmix',

View File

@@ -127,7 +127,7 @@ Init( void )
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
printf("GL_EXT_framebuffer_object not found!\n");
/*exit(0);*/
exit(0);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

View File

@@ -0,0 +1,318 @@
/* Copyright (c) Mark J. Kilgard, 1994. */
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
* clause at DFARS 252.227-7013 and/or in similar or successor
* clauses in the FAR or the DOD or NASA FAR Supplement.
* Unpublished-- rights reserved under the copyright laws of the
* United States. Contractor/manufacturer is Silicon Graphics,
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
*
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
/* mipmap_comp
* Test compressed texture mipmaps
*
* Based on mipmap_limits
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
#define SIZE 16 /* not larger then 16 */
static GLint BaseLevel = 0, MaxLevel ;
static GLfloat MinLod, MaxLod;
static GLfloat LodBias;
static GLboolean NearestFilter;
static GLuint texImage;
static GLuint View;
struct view {
GLfloat minLod;
GLfloat maxLod;
const char *string;
};
static struct view views[] =
{
{ 0, 0, "Green" },
{ 0, 1, "Green, Red" },
{ 0, 2, "Green, Red, Blue" },
{ 0, 3, "Green, Red, Blue, Black" },
{ 0, 4, "Green, Red, Blue, Black, White" },
{ 1, 4, "Red, Blue, Black, White" },
{ 2, 4, "Blue, Black, White" },
{ 3, 4, "Black, White" },
{ 4, 4, "White" },
{ 3, 3, "Black" },
{ 2, 2, "Blue" },
{ 1, 1, "Red" },
{ 1, 3, "Red, Blue, Black" },
{ 1, 2, "Red, Blue" },
{ 2, 3, "Blue, Black" },
{ 0, 0, NULL },
};
static void
initValues(void)
{
View = 12;
BaseLevel = 0;
MaxLevel = 9;
MinLod = views[View].minLod;
MaxLod = views[View].maxLod;
LodBias = 5.0;
NearestFilter = GL_TRUE;
}
static void
changeView(void)
{
if (views[++View].string == NULL)
View = 0;
MinLod = views[View].minLod;
MaxLod = views[View].maxLod;
}
static void
makeImage(int level, int width, int height)
{
GLubyte img[SIZE*SIZE*3];
GLubyte color[5][3] = {
{ 0, 255, 0 },
{ 255, 0, 0 },
{ 0, 0, 255 },
{ 0, 0, 0 },
{ 255, 255, 255 },
};
int i, j;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int k = (i * width + j) * 3;
img[k + 0] = color[level][0];
img[k + 1] = color[level][1];
img[k + 2] = color[level][2];
}
}
glTexImage2D(GL_TEXTURE_2D, level,
GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
width, height, 0,
GL_RGB, GL_UNSIGNED_BYTE, img);
}
static void
makeImages(void)
{
int i, sz;
for (i = 0, sz = SIZE; sz >= 1; i++, sz /= 2) {
makeImage(i, sz, sz);
printf("Level %d size: %d x %d\n", i, sz, sz);
}
}
static void
myInit(void)
{
initValues();
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glShadeModel(GL_FLAT);
glTranslatef(0.0, 0.0, -3.6);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &texImage);
glBindTexture(GL_TEXTURE_2D, texImage);
makeImages();
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glEnable(GL_TEXTURE_2D);
}
static void
display(void)
{
GLfloat tcm = 1.0;
glBindTexture(GL_TEXTURE_2D, texImage);
printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n",
BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
NearestFilter ? "NEAREST" : "LINEAR");
printf("You should see: %s\n", views[View].string );
fflush(stdout);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod);
if (NearestFilter) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST_MIPMAP_NEAREST);
}
else {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
}
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0);
glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
glEnd();
glFlush();
}
static void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
#if 0
case 'b':
BaseLevel--;
if (BaseLevel < 0)
BaseLevel = 0;
break;
case 'B':
BaseLevel++;
if (BaseLevel > 10)
BaseLevel = 10;
break;
case 'm':
MaxLevel--;
if (MaxLevel < 0)
MaxLevel = 0;
break;
case 'M':
MaxLevel++;
if (MaxLevel > 10)
MaxLevel = 10;
break;
case 'l':
LodBias -= 0.25;
break;
case 'L':
LodBias += 0.25;
break;
case 'n':
MinLod -= 0.25;
break;
case 'N':
MinLod += 0.25;
break;
case 'x':
MaxLod -= 0.25;
break;
case 'X':
MaxLod += 0.25;
break;
case 'f':
NearestFilter = !NearestFilter;
break;
#endif
case ' ':
initValues();
break;
case 27: /* Escape */
exit(0);
break;
default:
changeView();
break;
}
glutPostRedisplay();
}
static void
usage(void)
{
printf("usage:\n");
printf(" Any Change view\n");
printf(" SPACE reset values\n");
}
int
main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize (600, 600);
glutCreateWindow (argv[0]);
glewInit();
myInit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
usage();
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -0,0 +1,138 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
* Copyright (c) 2009 VMware, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
struct program
{
unsigned width;
unsigned height;
int i;
};
struct program prog;
static void init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
prog.i = 0;
}
static void reshape(int width, int height)
{
glViewport(0, 0, 100, 100);
prog.width = width;
prog.height = height;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
glutPostRedisplay();
return;
}
}
static void drawQuad(void)
{
glBegin(GL_QUADS);
glVertex2d(-1.0, -1.0);
glVertex2d( 1.0, -1.0);
glVertex2d( 1.0, 1.0);
glVertex2d(-1.0, 1.0);
glEnd();
}
static void draw(void)
{
int i;
glClearColor(0.0, 0.0, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
i = prog.i++;
if (prog.i >= 3)
prog.i = 0;
glEnable(GL_SCISSOR_TEST);
{
glColor4d(1.0, 0.0, 0.0, 1.0);
glScissor(i, i, 10 - 2*i, 10 - 2*i);
drawQuad();
}
glDisable(GL_SCISSOR_TEST);
//glutSwapBuffers();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
prog.width = 200;
prog.height = 200;
glutInitWindowPosition(100, 0);
glutInitWindowSize(prog.width, prog.height);
//type = GLUT_RGB | GLUT_DOUBLE;
type = GLUT_RGB | GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
init();
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}

168
progs/tests/scissor.c Normal file
View File

@@ -0,0 +1,168 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
* Copyright (c) 2009 VMware, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
struct program
{
unsigned width;
unsigned height;
unsigned quads;
};
struct program prog;
static void init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
}
static void reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
prog.width = width;
prog.height = height;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
prog.quads = !prog.quads;
glutPostRedisplay();
return;
}
}
static void drawQuad(void)
{
if (prog.quads) {
glBegin(GL_QUADS);
glVertex2d(-1.0, -1.0);
glVertex2d( 1.0, -1.0);
glVertex2d( 1.0, 1.0);
glVertex2d(-1.0, 1.0);
glEnd();
} else {
glClear(GL_COLOR_BUFFER_BIT);
}
}
static void draw(void)
{
glClearColor(0.0, 0.0, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
printf("drawing with %s\n", prog.quads ? "quads" : "clears");
glEnable(GL_SCISSOR_TEST);
{
glClearColor(1.0, 0.0, 0.0, 1.0);
glColor4d(1.0, 0.0, 0.0, 1.0);
glScissor(1, 1, 10, 10);
drawQuad();
glScissor(1, prog.height - 11, 10, 10);
drawQuad();
glScissor(prog.width - 11, prog.height - 11, 10, 10);
drawQuad();
}
{
glClearColor(0.0, 1.0, 0.0, 1.0);
glColor4d(0.0, 1.0, 0.0, 1.0);
glScissor(12, 1, 10, 10);
drawQuad();
glScissor(12, prog.height - 11, 10, 10);
drawQuad();
glScissor(prog.width - 22, prog.height - 11, 10, 10);
drawQuad();
}
{
glClearColor(1.0, 1.0, 0.0, 1.0);
glColor4d(1.0, 1.0, 0.0, 1.0);
glScissor(1, 12, 10, 10);
drawQuad();
glScissor(1, prog.height - 22, 10, 10);
drawQuad();
glScissor(prog.width - 11, prog.height - 22, 10, 10);
drawQuad();
}
glDisable(GL_SCISSOR_TEST);
//glutSwapBuffers();
glFlush();
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
prog.width = 200;
prog.height = 200;
glutInitWindowPosition(100, 0);
glutInitWindowSize(prog.width, prog.height);
//type = GLUT_RGB | GLUT_DOUBLE;
type = GLUT_RGB | GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
init();
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}

4100
progs/tests/texcomp_image.h Normal file

File diff suppressed because it is too large Load Diff

165
progs/tests/texcompsub.c Normal file
View File

@@ -0,0 +1,165 @@
/*
* Test texture compression.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "texcomp_image.h"
static int ImgWidth = 512;
static int ImgHeight = 512;
static GLenum CompFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
static GLfloat EyeDist = 5.0;
static GLfloat Rot = 0.0;
const GLenum Target = GL_TEXTURE_2D;
static void
CheckError(int line)
{
GLenum err = glGetError();
if (err) {
printf("GL Error %d at line %d\n", (int) err, line);
}
}
static void
LoadCompressedImage(void)
{
const GLenum filter = GL_LINEAR;
glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0,
GL_RGB, GL_UNSIGNED_BYTE, NULL);
/* bottom half */
glCompressedTexSubImage2DARB(Target, 0,
0, 0, /* pos */
ImgWidth, ImgHeight / 2,
CompFormat, ImgSize / 2, ImgData + ImgSize / 2);
/* top half */
glCompressedTexSubImage2DARB(Target, 0,
0, ImgHeight / 2, /* pos */
ImgWidth, ImgHeight / 2,
CompFormat, ImgSize / 2, ImgData);
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, filter);
}
static void
Init()
{
GLint numFormats, formats[100];
GLint p;
if (!glutExtensionSupported("GL_ARB_texture_compression")) {
printf("Sorry, GL_ARB_texture_compression is required.\n");
exit(1);
}
if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
printf("Sorry, GL_EXT_texture_compression_s3tc is required.\n");
exit(1);
}
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numFormats);
glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB, formats);
printf("%d supported compression formats: ", numFormats);
for (p = 0; p < numFormats; p++)
printf("0x%x ", formats[p]);
printf("\n");
glEnable(GL_TEXTURE_2D);
LoadCompressedImage();
}
static void
Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum(-1, 1, -1, 1, 4, 100);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
static void
Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 'd':
EyeDist -= 1.0;
if (EyeDist < 4.0)
EyeDist = 4.0;
break;
case 'D':
EyeDist += 1.0;
break;
case 'z':
Rot += 5.0;
break;
case 'Z':
Rot -= 5.0;
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
Draw( void )
{
glClearColor(0.3, 0.3, .8, 0);
glClear(GL_COLOR_BUFFER_BIT);
CheckError(__LINE__);
glPushMatrix();
glTranslatef(0, 0, -(EyeDist+0.01));
glRotatef(Rot, 0, 0, 1);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-1, -1);
glTexCoord2f(1, 0); glVertex2f( 1, -1);
glTexCoord2f(1, 1); glVertex2f( 1, 1);
glTexCoord2f(0, 1); glVertex2f(-1, 1);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
int
main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitWindowSize( 600, 600 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Draw );
Init();
glutMainLoop();
return 0;
}

View File

@@ -258,8 +258,26 @@ static void Init( void )
}
glBindTexture(GL_TEXTURE_2D, BORDER_TEXTURE);
#ifdef TEST_PBO_DLIST
/* test fetching teximage from PBO in display list */
{
GLuint b = 42, l = 10;
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, b);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER, sizeof(BorderImage),
BorderImage, GL_STREAM_DRAW);
glNewList(l, GL_COMPILE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
GL_RGBA, GL_UNSIGNED_BYTE, (void *) 0/* BorderImage*/);
glEndList();
glCallList(l);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, 0);
}
#else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
GL_RGBA, GL_UNSIGNED_BYTE, (void *) BorderImage);
#endif
for (i = 0; i < SIZE; i++) {
for (j = 0; j < SIZE; j++) {

View File

@@ -21,7 +21,7 @@ static void Display(void)
GLfloat min, max;
int i;
glClearColor(0.5, 0.5, 0.5, 0);
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* draw a sphere */
@@ -82,7 +82,7 @@ static void Key(unsigned char key, int x, int y)
static void Init(void)
{
const GLfloat blue[4] = {.1, .1, 1.0, 0.0};
const GLfloat blue[4] = {.1, .1, 1.0, 1.0};
const GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0};
const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
const GLfloat pos[4] = {0, 0, 10, 0};

View File

@@ -5,10 +5,17 @@ clear-random
clear-repeat
clear-scissor
clear-undefined
createwin
dlist-begin-call-end
dlist-dangling
dlist-degenerate
dlist-edgeflag
dlist-edgeflag-dangling
dlist-flat-tri
dlist-mat-tri
dlist-recursive-call
dlist-tri-flat-tri
dlist-tri-mat-tri
draw2arrays
drawarrays
drawelements
@@ -30,6 +37,7 @@ lineloop
lineloop-clip
lineloop-elts
linestrip
linestrip-clip
linestrip-flat-stipple
linestrip-stipple
linestrip-stipple-wide
@@ -70,8 +78,10 @@ quadstrip-cont
quadstrip-flat
readtex.c
readtex.h
readpixels
tri
tri-alpha
tri-alpha-tex
tri-array-interleaved
tri-blend
tri-blend-color
@@ -79,6 +89,7 @@ tri-blend-max
tri-blend-min
tri-blend-revsub
tri-blend-sub
tri-clear
tri-clip
tri-cull
tri-cull-both
@@ -93,6 +104,7 @@ tri-fog
tri-fp
tri-fp-const-imm
tri-lit
tri-lit-material
tri-logicop-none
tri-logicop-xor
tri-mask-tri
@@ -101,6 +113,7 @@ tri-orig
tri-query
tri-repeat
tri-scissor-tri
tri-square
tri-stencil
tri-stipple
tri-tex
@@ -110,6 +123,7 @@ tri-unfilled
tri-unfilled-clip
tri-unfilled-edgeflag
tri-unfilled-fog
tri-unfilled-point
tri-unfilled-smooth
tri-unfilled-tri
tri-unfilled-tri-lit
@@ -118,6 +132,7 @@ tri-unfilled-userclip-stip
tri-userclip
tri-viewport
tri-z
tri-z-9
tri-z-eq
trifan
trifan-flat

View File

@@ -18,7 +18,14 @@ SOURCES = \
clear-repeat.c \
clear-random.c \
clear.c \
createwin.c \
dlist-dangling.c \
dlist-flat-tri.c \
dlist-mat-tri.c \
dlist-tri-flat-tri.c \
dlist-tri-mat-tri.c \
dlist-recursive-call.c \
dlist-begin-call-end.c \
dlist-edgeflag-dangling.c \
dlist-edgeflag.c \
dlist-degenerate.c \
@@ -42,6 +49,7 @@ SOURCES = \
lineloop-clip.c \
lineloop-elts.c \
lineloop.c \
linestrip-clip.c \
linestrip-flat-stipple.c \
linestrip-stipple-wide.c \
linestrip-stipple.c \
@@ -81,7 +89,9 @@ SOURCES = \
quadstrip-cont.c \
quadstrip-flat.c \
quadstrip.c \
readpixels.c \
tri-alpha.c \
tri-alpha-tex.c \
tri-array-interleaved.c \
tri-blend-color.c \
tri-blend-max.c \
@@ -89,6 +99,7 @@ SOURCES = \
tri-blend-revsub.c \
tri-blend-sub.c \
tri-blend.c \
tri-clear.c \
tri-clip.c \
tri-cull-both.c \
tri-cull.c \
@@ -105,11 +116,13 @@ SOURCES = \
tri-fp.c \
tri-fp-const-imm.c \
tri-lit.c \
tri-lit-material.c \
tri-mask-tri.c \
tri-orig.c \
tri-query.c \
tri-repeat.c \
tri-scissor-tri.c \
tri-square.c \
tri-stencil.c \
tri-stipple.c \
tri-multitex-vbo.c \
@@ -119,6 +132,7 @@ SOURCES = \
tri-unfilled-fog.c \
tri-unfilled-edgeflag.c \
tri-unfilled-clip.c \
tri-unfilled-point.c \
tri-unfilled-smooth.c \
tri-unfilled-tri.c \
tri-unfilled-tri-lit.c \
@@ -127,6 +141,7 @@ SOURCES = \
tri-unfilled.c \
tri-userclip.c \
tri-viewport.c \
tri-z-9.c \
tri-z-eq.c \
tri-z.c \
tri.c \

View File

@@ -0,0 +1,159 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint first_list, list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
/* First list will disrupt state which might potentially be
* short-circuited in calling list:
*/
first_list = glGenLists(1);
glNewList(first_list, GL_COMPILE);
// glColor3f(0,1,0);
glEndList();
/* List that looks like it might have redundant state:
*/
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glShadeModel(GL_FLAT);
glBegin(GL_TRIANGLES);
glColor3f(1,0,0);
glVertex3f( -0.9, 0.9, -30.0);
glVertex3f( -0.9, -0.9, -30.0);
glCallList( first_list );
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,171 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
/* XXX: this state-change will only be executed if list is called
* from outside a begin/end pair:
*/
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( -0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f( -0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
/* This statechange is potentially NOT redundant:
*/
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(0,1,0);
glVertex3f( -0.5, 0.5, -30.0);
glColor3f(0,0,1);
glVertex3f( -0.5, -0.5, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glBegin(GL_TRIANGLES);
/* Note: call the list from inside a begin/end pair. The end is
* provided by the display list...
*/
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,182 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
/*static GLfloat blue[4] = {0.2, 0.2, .7, 1.0};*/
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
/* XXX: this state-change will be executed regardless of whether
* the list is called from outside a begin/end pair:
*/
glMaterialfv(GL_FRONT, GL_AMBIENT, red);
glBegin(GL_TRIANGLES);
glVertex3f( -0.9, 0.9, -30.0);
glVertex3f( -0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
glMaterialfv(GL_FRONT, GL_DIFFUSE, red);
glBegin(GL_TRIANGLES);
glVertex3f( -0.7, 0.7, -30.0);
glVertex3f( -0.7, -0.7, -30.0);
glVertex3f( 0.7, 0.0, -30.0);
glEnd();
/* This statechange is redundant:
*/
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
glBegin(GL_TRIANGLES);
glVertex3f( -0.5, 0.5, -30.0);
glVertex3f( -0.5, -0.5, -30.0);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
glBegin(GL_TRIANGLES);
/* Note: call the list from inside a begin/end pair. The end is
* provided by the display list...
*/
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,190 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint first_list, list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
/* First list will disrupt state which might potentially be
* short-circuited in calling list:
*/
first_list = glGenLists(1);
glNewList(first_list, GL_COMPILE);
glShadeModel( GL_SMOOTH );
glEndList();
/* List that looks like it might have redundant state:
*/
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( -0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f( -0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
glCallList( first_list );
/* Do a quick begin/end to ensure we are not inside a dangling
* primitive from the called list:
*/
glBegin( GL_POINTS );
glEnd();
/* This statechange is NOT redundant:
*/
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(1,0,0);
glVertex3f( -0.5, 0.5, -30.0);
glColor3f(0,1,0);
glVertex3f( -0.5, -0.5, -30.0);
glColor3f(0,0,1);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,171 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(0,0,.7);
glVertex3f( -0.9, 0.9, -30.0);
glColor3f(0,.9,0);
glVertex3f( -0.9, -0.9, -30.0);
glColor3f(.8,0,0);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
/* This statechange is redundant:
*/
glShadeModel( GL_FLAT );
glBegin(GL_TRIANGLES);
glColor3f(1,0,0);
glVertex3f( -0.5, 0.5, -30.0);
glColor3f(0,1,0);
glVertex3f( -0.5, -0.5, -30.0);
glColor3f(0,0,1);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,174 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
GLint list;
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, .9, 1.0};
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glClearColor(0.0, 0.0, 1.0, 0.0);
list = glGenLists(1);
glNewList(list, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
glBegin(GL_TRIANGLES);
glNormal3f(0,0,.7);
glVertex3f( 0.9, -0.9, -30.0);
glVertex3f( 0.9, 0.9, -30.0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
glBegin(GL_TRIANGLES);
glVertex3f( -0.9, 0.9, -30.0);
glVertex3f( -0.9, -0.9, -30.0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
glVertex3f( 0.9, 0.0, -30.0);
glEnd();
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
glBegin(GL_TRIANGLES);
glVertex3f( -0.5, 0.5, -30.0);
glVertex3f( -0.5, -0.5, -30.0);
glVertex3f( 0.5, 0.0, -30.0);
glEnd();
glEndList();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel( GL_SMOOTH );
glCallList(list);
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the name of
* Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
* ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
#define CI_OFFSET_1 16
#define CI_OFFSET_2 32
GLenum doubleBuffer;
static void Init(void)
{
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
fflush(stderr);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glClearColor(0.0, 0.0, 1.0, 0.0);
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */
glMatrixMode(GL_MODELVIEW);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(1);
default:
return;
}
glutPostRedisplay();
}
static void Draw(void)
{
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] = {0.2, 0.2, .9, 1.0};
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
glNormal3f(0,0,.7);
glVertex3f( 0.9, -0.9, -0.0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
glNormal3f(0,0,.8);
glVertex3f( 0.9, 0.9, -0.0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
glNormal3f(0,0,.9);
glVertex3f(-0.9, 0.0, -0.0);
glEnd();
glFlush();
if (doubleBuffer) {
glutSwapBuffers();
}
}
static GLenum Args(int argc, char **argv)
{
GLint i;
doubleBuffer = GL_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-sb") == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], "-db") == 0) {
doubleBuffer = GL_TRUE;
} else {
fprintf(stderr, "%s (Bad option).\n", argv[i]);
return GL_FALSE;
}
}
return GL_TRUE;
}
int main(int argc, char **argv)
{
GLenum type;
glutInit(&argc, argv);
if (Args(argc, argv) == GL_FALSE) {
exit(1);
}
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
type = GLUT_RGB | GLUT_ALPHA;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
if (glutCreateWindow(*argv) == GL_FALSE) {
exit(1);
}
Init();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

View File

@@ -57,13 +57,19 @@ static struct { GLenum func; const char *str; } funcs[] =
static int curFunc = 0;
static double clearVal = 1.0;
static float minZ = 0.0;
static float maxZ = 1.0;
static void usage(void)
{
printf("t - toggle rendering order of triangles\n");
printf("c - toggle Z clear value between 0, 1\n");
printf("f - cycle through depth test functions\n");
printf("t - toggle rendering order of triangles\n");
printf("c - toggle Z clear value between 0, 1\n");
printf("f - cycle through depth test functions\n");
printf("n/N - decrease/increase depthrange minZ\n");
printf("x/X - decrease/increase depthrange maxZ\n");
printf("spc - reset\n");
printf("z - set to reverse-direction (ztrick) mode\n");
fflush(stdout);
}
@@ -97,9 +103,11 @@ static void drawRightTriangle(void)
void display(void)
{
printf("GL_CLEAR_DEPTH = %f GL_DEPTH_FUNC = %s\n",
clearVal, funcs[curFunc].str);
printf("GL_CLEAR_DEPTH = %.2f, GL_DEPTH_FUNC = %s, DepthRange(%.1f, %.1f)\n",
clearVal, funcs[curFunc].str, minZ, maxZ);
fflush(stdout);
glClearDepth(clearVal);
glDepthRange(minZ, maxZ);
glDepthFunc(funcs[curFunc].func);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -131,27 +139,49 @@ void reshape(int w, int h)
void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 'n':
minZ -= .1;
break;
case 'N':
minZ += .1;
break;
case 'x':
maxZ -= .1;
break;
case 'X':
maxZ += .1;
break;
case 'c':
case 'C':
clearVal = 1.0 - clearVal;
glutPostRedisplay();
break;
case 'f':
case 'F':
curFunc = (curFunc + 1) % NUM_FUNCS;
glutPostRedisplay();
break;
case 't':
case 'T':
leftFirst = !leftFirst;
glutPostRedisplay();
break;
case ' ':
curFunc = 0;
clearVal = 1.0;
minZ = 0.0;
maxZ = 1.0;
break;
case 'z':
curFunc = 2;
clearVal = 0.0;
minZ = 1.0;
maxZ = 0.0;
break;
case 27: /* Escape key */
exit(0);
break;
default:
break;
return;
}
glutPostRedisplay();
}
/* Main Loop

View File

@@ -86,6 +86,57 @@ static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL;
/* GL_EXT_stencil_two_side */
static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL;
/* GL_ARB_buffer_object */
static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL;
static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL;
static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL;
static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL;
static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL;
static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL;
static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL;
/* GL_EXT_framebuffer_object */
static PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT_func = NULL;
static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT_func = NULL;
static PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT_func = NULL;
static PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT_func = NULL;
static PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT_func = NULL;
static PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT_func = NULL;
static PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT_func = NULL;
static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT_func = NULL;
static PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT_func = NULL;
static PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT_func = NULL;
static PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT_func = NULL;
static PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT_func = NULL;
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT_func = NULL;
static PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT_func = NULL;
/* GL_ARB_framebuffer_object */
static PFNGLISRENDERBUFFERPROC glIsRenderbuffer_func = NULL;
static PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer_func = NULL;
static PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers_func = NULL;
static PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers_func = NULL;
static PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage_func = NULL;
static PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv_func = NULL;
static PFNGLISFRAMEBUFFERPROC glIsFramebuffer_func = NULL;
static PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer_func = NULL;
static PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers_func = NULL;
static PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers_func = NULL;
static PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D_func = NULL;
static PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D_func = NULL;
static PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer_func = NULL;
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv_func = NULL;
static PFNGLGENERATEMIPMAPPROC glGenerateMipmap_func = NULL;
static PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer_func = NULL;
static PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample_func = NULL;
static PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer_func = NULL;
static void
GetExtensionFuncs(void)
@@ -173,5 +224,55 @@ GetExtensionFuncs(void)
/* GL_EXT_stencil_two_side */
glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT");
/* GL_ARB_vertex_buffer_object */
glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB");
glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB");
glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB");
glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB");
glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB");
glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB");
glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB");
/* GL_EXT_framebuffer_object */
glIsRenderbufferEXT_func = (PFNGLISRENDERBUFFEREXTPROC) glutGetProcAddress("glIsRenderbufferEXT");
glBindRenderbufferEXT_func = (PFNGLBINDRENDERBUFFEREXTPROC) glutGetProcAddress("glBindRenderbufferEXT");
glDeleteRenderbuffersEXT_func = (PFNGLDELETERENDERBUFFERSEXTPROC) glutGetProcAddress("glDeleteRenderbuffersEXT");
glGenRenderbuffersEXT_func = (PFNGLGENRENDERBUFFERSEXTPROC) glutGetProcAddress("glGenRenderbuffersEXT");
glRenderbufferStorageEXT_func = (PFNGLRENDERBUFFERSTORAGEEXTPROC) glutGetProcAddress("glRenderbufferStorageEXT");
glGetRenderbufferParameterivEXT_func = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) glutGetProcAddress("glGetRenderbufferParameterivEXT");
glIsFramebufferEXT_func = (PFNGLISFRAMEBUFFEREXTPROC) glutGetProcAddress("glIsFramebufferEXT");
glBindFramebufferEXT_func = (PFNGLBINDFRAMEBUFFEREXTPROC) glutGetProcAddress("glBindFramebufferEXT");
glDeleteFramebuffersEXT_func = (PFNGLDELETEFRAMEBUFFERSEXTPROC) glutGetProcAddress("glDeleteFramebuffersEXT");
glGenFramebuffersEXT_func = (PFNGLGENFRAMEBUFFERSEXTPROC) glutGetProcAddress("glGenFramebuffersEXT");
glCheckFramebufferStatusEXT_func = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) glutGetProcAddress("glCheckFramebufferStatusEXT");
glFramebufferTexture1DEXT_func = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) glutGetProcAddress("glFramebufferTexture1DEXT");
glFramebufferTexture2DEXT_func = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) glutGetProcAddress("glFramebufferTexture2DEXT");
glFramebufferTexture3DEXT_func = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) glutGetProcAddress("glFramebufferTexture3DEXT");
glFramebufferRenderbufferEXT_func = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) glutGetProcAddress("glFramebufferRenderbufferEXT");
glGetFramebufferAttachmentParameterivEXT_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) glutGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
glGenerateMipmapEXT_func = (PFNGLGENERATEMIPMAPEXTPROC) glutGetProcAddress("glGenerateMipmapEXT");
/* GL_ARB_framebuffer_object */
glIsRenderbuffer_func = (PFNGLISRENDERBUFFERPROC) glutGetProcAddress("glIsRenderbuffer");
glBindRenderbuffer_func = (PFNGLBINDRENDERBUFFERPROC) glutGetProcAddress("glBindRenderbuffer");
glDeleteRenderbuffers_func = (PFNGLDELETERENDERBUFFERSPROC) glutGetProcAddress("glDeleteRenderbuffers");
glGenRenderbuffers_func = (PFNGLGENRENDERBUFFERSPROC) glutGetProcAddress("glGenRenderbuffers");
glRenderbufferStorage_func = (PFNGLRENDERBUFFERSTORAGEPROC) glutGetProcAddress("glRenderbufferStorage");
glGetRenderbufferParameteriv_func = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) glutGetProcAddress("glGetRenderbufferParameteriv");
glIsFramebuffer_func = (PFNGLISFRAMEBUFFERPROC) glutGetProcAddress("glIsFramebuffer");
glBindFramebuffer_func = (PFNGLBINDFRAMEBUFFERPROC) glutGetProcAddress("glBindFramebuffer");
glDeleteFramebuffers_func = (PFNGLDELETEFRAMEBUFFERSPROC) glutGetProcAddress("glDeleteFramebuffers");
glGenFramebuffers_func = (PFNGLGENFRAMEBUFFERSPROC) glutGetProcAddress("glGenFramebuffers");
glCheckFramebufferStatus_func = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) glutGetProcAddress("glCheckFramebufferStatus");
glFramebufferTexture1D_func = (PFNGLFRAMEBUFFERTEXTURE1DPROC) glutGetProcAddress("glFramebufferTexture1D");
glFramebufferTexture2D_func = (PFNGLFRAMEBUFFERTEXTURE2DPROC) glutGetProcAddress("glFramebufferTexture2D");
glFramebufferTexture3D_func = (PFNGLFRAMEBUFFERTEXTURE3DPROC) glutGetProcAddress("glFramebufferTexture3D");
glFramebufferRenderbuffer_func = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) glutGetProcAddress("glFramebufferRenderbuffer");
glGetFramebufferAttachmentParameteriv_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) glutGetProcAddress("glGetFramebufferAttachmentParameteriv");
glGenerateMipmap_func = (PFNGLGENERATEMIPMAPPROC) glutGetProcAddress("glGenerateMipmap");
glBlitFramebuffer_func = (PFNGLBLITFRAMEBUFFERPROC) glutGetProcAddress("glBlitFramebuffer");
glRenderbufferStorageMultisample_func = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) glutGetProcAddress("glRenderbufferStorageMultisample");
glFramebufferTextureLayer_func = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) glutGetProcAddress("glFramebufferTextureLayer");
}

View File

@@ -9,8 +9,8 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "extfuncs.h"
#include "shaderutil.h"
@@ -19,7 +19,6 @@ Init(void)
{
static GLboolean firstCall = GL_TRUE;
if (firstCall) {
GetExtensionFuncs();
firstCall = GL_FALSE;
}
}
@@ -50,14 +49,14 @@ CompileShaderText(GLenum shaderType, const char *text)
Init();
shader = glCreateShader_func(shaderType);
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
shader = glCreateShader(shaderType);
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
glCompileShader(shader);
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "Error: problem compiling shader: %s\n", log);
exit(1);
}
@@ -78,8 +77,12 @@ CompileShaderFile(GLenum shaderType, const char *filename)
int n;
char *buffer = (char*) malloc(max);
GLuint shader;
FILE *f;
FILE *f = fopen(filename, "r");
Init();
f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "Unable to open shader file %s\n", filename);
return 0;
@@ -105,24 +108,24 @@ CompileShaderFile(GLenum shaderType, const char *filename)
GLuint
LinkShaders(GLuint vertShader, GLuint fragShader)
{
GLuint program = glCreateProgram_func();
GLuint program = glCreateProgram();
assert(vertShader || fragShader);
if (fragShader)
glAttachShader_func(program, fragShader);
glAttachShader(program, fragShader);
if (vertShader)
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
glAttachShader(program, vertShader);
glLinkProgram(program);
/* check link */
{
GLint stat;
glGetProgramiv_func(program, GL_LINK_STATUS, &stat);
glGetProgramiv(program, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(program, 1000, &len, log);
glGetProgramInfoLog(program, 1000, &len, log);
fprintf(stderr, "Shader link error:\n%s\n", log);
return 0;
}
@@ -139,7 +142,7 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
for (i = 0; uniforms[i].name; i++) {
uniforms[i].location
= glGetUniformLocation_func(program, uniforms[i].name);
= glGetUniformLocation(program, uniforms[i].name);
printf("Uniform %s location: %d\n", uniforms[i].name,
uniforms[i].location);
@@ -147,19 +150,19 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
switch (uniforms[i].size) {
case 1:
if (uniforms[i].type == GL_INT)
glUniform1i_func(uniforms[i].location,
glUniform1i(uniforms[i].location,
(GLint) uniforms[i].value[0]);
else
glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value);
glUniform1fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 2:
glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value);
glUniform2fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 3:
glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value);
glUniform3fv(uniforms[i].location, 1, uniforms[i].value);
break;
case 4:
glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value);
glUniform4fv(uniforms[i].location, 1, uniforms[i].value);
break;
default:
abort();

View File

@@ -0,0 +1,6 @@
void main() {
gl_FrontColor = gl_Color;
gl_PointSize = 2.0;
gl_Position = gl_Vertex;
}

View File

@@ -0,0 +1,6 @@
void main() {
gl_FrontColor = gl_Color;
gl_PointSize = 10 * gl_Color.x;
gl_Position = gl_Vertex;
}

View File

@@ -10,6 +10,10 @@
static const char *filename = NULL;
static GLuint nr_steps = 4;
static GLuint prim = GL_TRIANGLES;
static GLfloat psz = 1.0;
static GLboolean pointsmooth = 0;
static GLboolean program_point_size = 0;
static GLuint fragShader;
static GLuint vertShader;
@@ -229,6 +233,14 @@ static void subdiv( union vert *v0,
}
}
static void enable( GLenum value, GLboolean flag )
{
if (flag)
glEnable(value);
else
glDisable(value);
}
/** Assignment */
#define ASSIGN_3V( V, V0, V1, V2 ) \
do { \
@@ -241,10 +253,13 @@ static void Display( void )
{
glClearColor(0.3, 0.3, 0.3, 1);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPointSize(psz);
glUseProgram(program);
enable( GL_POINT_SMOOTH, pointsmooth );
enable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB, program_point_size );
glBegin(GL_TRIANGLES);
glBegin(prim);
{
@@ -291,10 +306,41 @@ static void Key( unsigned char key, int x, int y )
(void) x;
(void) y;
switch (key) {
case 27:
CleanUp();
exit(0);
break;
case 'p':
prim = GL_POINTS;
break;
case 't':
prim = GL_TRIANGLES;
break;
case 's':
psz += .5;
break;
case 'S':
if (psz > .5)
psz -= .5;
break;
case 'm':
pointsmooth = !pointsmooth;
break;
case 'z':
program_point_size = !program_point_size;
break;
case '+':
nr_steps++;
break;
case '-':
if (nr_steps)
nr_steps--;
break;
case ' ':
psz = 1.0;
prim = GL_TRIANGLES;
nr_steps = 4;
break;
case 27:
CleanUp();
exit(0);
break;
}
glutPostRedisplay();
}
@@ -305,7 +351,7 @@ int main( int argc, char *argv[] )
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 250, 250 );
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glutCreateWindow(argv[argc-1]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );

View File

@@ -50,6 +50,7 @@ struct window {
float Angle;
int Id;
HGLRC sharedContext;
HANDLE hEventInitialised;
};
@@ -414,6 +415,10 @@ threadRunner (void *arg)
Error("Couldn't obtain HDC");
}
/* Wait for the previous thread */
if(tia->id > 0)
WaitForSingleObject(Windows[tia->id - 1].hEventInitialised, INFINITE);
pfd.cColorBits = 24;
pfd.cDepthBits = 24;
pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
@@ -434,9 +439,16 @@ threadRunner (void *arg)
}
if (win->sharedContext) {
wglShareLists(win->sharedContext, win->Context);
if(!wglShareLists(win->sharedContext, win->Context))
Error("Couldn't share WGL context lists");
}
SetEvent(win->hEventInitialised);
/* Wait for all threads to initialize otherwise wglShareLists will fail */
if(tia->id < NumWindows - 1)
WaitForSingleObject(Windows[NumWindows - 1].hEventInitialised, INFINITE);
SendMessage(win->Win, WM_SIZE, 0, 0);
while (1) {
@@ -511,20 +523,26 @@ main(int argc, char *argv[])
h[2] = AddWindow( 10, 350, gCtx);
h[3] = AddWindow(330, 350, gCtx);
if (!wglMakeCurrent(gHDC, gCtx)) {
Error("wglMakeCurrent failed for init thread.");
return -1;
for (i = 0; i < NumWindows; i++) {
Windows[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
}
InitGLstuff();
for (i = 0; i < NumWindows; i++) {
DWORD id;
tia[i].id = i;
threads[i] = CreateThread(NULL, 0, threadRunner, &tia[i], 0, &id);
WaitForSingleObject(Windows[i].hEventInitialised, INFINITE);
}
if (!wglMakeCurrent(gHDC, gCtx)) {
Error("wglMakeCurrent failed for init thread.");
return -1;
}
InitGLstuff();
while (1) {
MSG msg;

View File

@@ -348,7 +348,6 @@ print_screen_info(HDC _hdc, GLboolean limits)
HWND win;
HGLRC ctx;
int visinfo;
int width = 100, height = 100;
HDC hdc;
PIXELFORMATDESCRIPTOR pfd;
@@ -364,18 +363,18 @@ print_screen_info(HDC _hdc, GLboolean limits)
win = CreateWindowEx(0,
wc.lpszClassName,
"wglinfo",
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
width,
height,
NULL,
NULL,
wc.hInstance,
NULL);
if (!win) {
fprintf(stderr, "Couldn't create window");
exit(1);
return;
}
hdc = GetDC(win);
@@ -476,7 +475,7 @@ print_visual_attribs_verbose(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd)
ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0);
printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n",
0 /* ppfd->bufferSize */, 0 /* ppfd->level */,
visual_render_type_name(ppfd->dwFlags),
visual_render_type_name(ppfd->iPixelType),
ppfd->dwFlags & PFD_DOUBLEBUFFER ? 1 : 0,
ppfd->dwFlags & PFD_STEREO ? 1 : 0);
printf(" rgba: cRedBits=%d cGreenBits=%d cBlueBits=%d cAlphaBits=%d\n",

View File

@@ -72,6 +72,7 @@ struct winthread {
int WinWidth, WinHeight;
GLboolean NewSize;
HANDLE hEventInitialised;
GLboolean Initialized;
GLboolean MakeNewTexture;
HANDLE hEventRedraw;
};
@@ -114,20 +115,20 @@ static void
MakeNewTexture(struct winthread *wt)
{
#define TEX_SIZE 128
static float step = 0.0;
static float step = 0.0f;
GLfloat image[TEX_SIZE][TEX_SIZE][4];
GLint width;
int i, j;
for (j = 0; j < TEX_SIZE; j++) {
for (i = 0; i < TEX_SIZE; i++) {
float dt = 5.0 * (j - 0.5 * TEX_SIZE) / TEX_SIZE;
float ds = 5.0 * (i - 0.5 * TEX_SIZE) / TEX_SIZE;
float dt = 5.0f * (j - 0.5f * TEX_SIZE) / TEX_SIZE;
float ds = 5.0f * (i - 0.5f * TEX_SIZE) / TEX_SIZE;
float r = dt * dt + ds * ds + step;
image[j][i][0] =
image[j][i][1] =
image[j][i][2] = 0.75 + 0.25 * cos(r);
image[j][i][3] = 1.0;
image[j][i][2] = 0.75f + 0.25f * (float) cos(r);
image[j][i][3] = 1.0f;
}
}
@@ -159,7 +160,7 @@ static void
draw_object(void)
{
glPushMatrix();
glScalef(0.75, 0.75, 0.75);
glScalef(0.75f, 0.75f, 0.75f);
glColor3f(1, 0, 0);
@@ -288,6 +289,15 @@ draw_loop(struct winthread *wt)
wglMakeCurrent(wt->hDC, wt->Context);
if (!wt->Initialized) {
printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index,
(char *) glGetString(GL_RENDERER));
if (Texture /*&& wt->Index == 0*/) {
MakeNewTexture(wt);
}
wt->Initialized = GL_TRUE;
}
if (Locking)
LeaveCriticalSection(&Mutex);
@@ -315,13 +325,15 @@ draw_loop(struct winthread *wt)
glPushMatrix();
glRotatef(wt->Angle, 0, 1, 0);
glRotatef(wt->Angle, 1, 0, 0);
glScalef(0.7, 0.7, 0.7);
glScalef(0.7f, 0.7f, 0.7f);
draw_object();
glPopMatrix();
if (Locking)
EnterCriticalSection(&Mutex);
SwapBuffers(wt->hDC);
if (Locking)
LeaveCriticalSection(&Mutex);
@@ -433,7 +445,7 @@ create_window(struct winthread *wt, HGLRC shareCtx)
win = CreateWindowEx(0,
wc.lpszClassName,
"wglthreads",
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TILEDWINDOW,
xpos,
ypos,
width,
@@ -471,7 +483,8 @@ create_window(struct winthread *wt, HGLRC shareCtx)
}
if (shareCtx) {
wglShareLists(shareCtx, ctx);
if(!wglShareLists(shareCtx, ctx))
Error("Couldn't share WGL context lists");
}
/* save the info for this window/context */
@@ -482,14 +495,6 @@ create_window(struct winthread *wt, HGLRC shareCtx)
wt->WinWidth = width;
wt->WinHeight = height;
wt->NewSize = GL_TRUE;
wglMakeCurrent(hdc, ctx);
printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index, (char *) glGetString(GL_RENDERER));
wglMakeCurrent(NULL, NULL);
if (Texture/* && wt->Index == 0*/) {
MakeNewTexture(wt);
}
}
@@ -502,10 +507,22 @@ ThreadProc(void *p)
struct winthread *wt = (struct winthread *) p;
HGLRC share;
/* Wait for the previous thread */
if(Texture && wt->Index > 0) {
WaitForSingleObject(WinThreads[wt->Index - 1].hEventInitialised, INFINITE);
share = WinThreads[0].Context;
}
else
share = 0;
share = (Texture && wt->Index > 0) ? WinThreads[0].Context : 0;
create_window(wt, share);
SetEvent(wt->hEventInitialised);
/* Wait for all threads to initialize otherwise wglShareLists will fail */
if(wt->Index < NumWinThreads - 1)
WaitForSingleObject(WinThreads[NumWinThreads - 1].hEventInitialised, INFINITE);
draw_loop(wt);
return 0;
}
@@ -539,6 +556,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-h") == 0) {
usage();
exit(0);
}
else if (strcmp(argv[i], "-l") == 0) {
Locking = 1;
@@ -588,13 +606,17 @@ main(int argc, char *argv[])
printf("wglthreads: creating threads\n");
/* Create the events */
for (i = 0; i < NumWinThreads; i++) {
WinThreads[i].Index = i;
WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
}
/* Create the threads */
for (i = 0; i < NumWinThreads; i++) {
DWORD id;
WinThreads[i].Index = i;
WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
WinThreads[i].Thread = CreateThread(NULL,
0,
ThreadProc,
@@ -603,8 +625,6 @@ main(int argc, char *argv[])
&id);
printf("wglthreads: Created thread %p\n", (void *) WinThreads[i].Thread);
WaitForSingleObject(WinThreads[i].hEventInitialised, INFINITE);
threads[i] = WinThreads[i].Thread;
}

View File

@@ -26,7 +26,7 @@
* -p Open a display connection for each thread
* -l Enable application-side locking
* -n <num threads> Number of threads to create (default is 2)
* -display <display name> Specify X display (default is :0.0)
* -display <display name> Specify X display (default is $DISPLAY)
* -t Use texture mapping
*
* Brian Paul 20 July 2000
@@ -573,7 +573,7 @@ usage(void)
int
main(int argc, char *argv[])
{
char *displayName = ":0.0";
char *displayName = NULL;
int numThreads = 2;
Display *dpy = NULL;
int i;

View File

@@ -20,16 +20,17 @@
*/
/*
* This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT)
* Port by Brian Paul 23 March 2001
* Version of glxgears that creates/destroys the rendering context for each
* frame. Also periodically destroy/recreate the window.
* Good for finding memory leaks, etc.
*
* Command line options:
* -info print GL implementation information
* -stereo use stereo enabled GLX visual
*
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
@@ -92,13 +93,8 @@ static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
static GLboolean stereo = GL_FALSE; /* Enable stereo. */
static GLfloat eyesep = 5.0; /* Eye separation. */
static GLfloat fix_point = 40.0; /* Fixation point distance. */
static GLfloat left, right, asp; /* Stereo frustum params. */
XVisualInfo *visinfo;
static XVisualInfo *visinfo = NULL;
static int WinWidth = 300, WinHeight = 300;
/*
@@ -272,22 +268,13 @@ do_draw(void)
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
glViewport(0, 0, (GLint) width, (GLint) height);
if (stereo) {
GLfloat w;
asp = (GLfloat) height / (GLfloat) width;
w = fix_point * (1.0 / 5.0);
left = -5.0 * ((w - 0.5 * eyesep) / fix_point);
right = 5.0 * ((w + 0.5 * eyesep) / fix_point);
} else {
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glMatrixMode(GL_PROJECTION);
@@ -299,7 +286,6 @@ reshape(int width, int height)
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
@@ -337,7 +323,7 @@ init(void)
glEnable(GL_NORMALIZE);
}
static void
draw( Display *dpy, Window win )
@@ -354,36 +340,9 @@ draw( Display *dpy, Window win )
init();
if (stereo) {
/* First left eye. */
glDrawBuffer(GL_BACK_LEFT);
reshape(WinWidth, WinHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(left, right, -asp, asp, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslated(+0.5 * eyesep, 0.0, 0.0);
do_draw();
glPopMatrix();
/* Then right eye. */
glDrawBuffer(GL_BACK_RIGHT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-right, -left, -asp, asp, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslated(-0.5 * eyesep, 0.0, 0.0);
do_draw();
glPopMatrix();
} else
do_draw();
do_draw();
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
@@ -410,14 +369,6 @@ make_window( Display *dpy, const char *name,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
None };
int stereoAttribs[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
GLX_STEREO,
None };
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
@@ -427,22 +378,12 @@ make_window( Display *dpy, const char *name,
scrnum = DefaultScreen( dpy );
root = RootWindow( dpy, scrnum );
if (fullscreen) {
x = 0; y = 0;
width = DisplayWidth( dpy, scrnum );
height = DisplayHeight( dpy, scrnum );
}
if (visinfo)
XFree(visinfo);
if (stereo)
visinfo = glXChooseVisual( dpy, scrnum, stereoAttribs );
else
visinfo = glXChooseVisual( dpy, scrnum, attribs );
visinfo = glXChooseVisual( dpy, scrnum, attribs );
if (!visinfo) {
if (stereo) {
printf("Error: couldn't get an RGB, "
"Double-buffered, Stereo visual\n");
} else
printf("Error: couldn't get an RGB, Double-buffered visual\n");
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
}
@@ -451,7 +392,7 @@ make_window( Display *dpy, const char *name,
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
attr.override_redirect = fullscreen;
attr.override_redirect = 0;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
win = XCreateWindow( dpy, root, x, y, width, height,
@@ -479,10 +420,9 @@ static void
event_loop(Display *dpy)
{
Window win;
make_window(dpy, "glxgears", 0, 0, 300, 300, &win);
make_window(dpy, "glxgears", 0, 0, WinWidth, WinHeight, &win);
XMapWindow(dpy, win);
while (1) {
while (XPending(dpy) > 0) {
XEvent event;
@@ -492,34 +432,35 @@ event_loop(Display *dpy)
/* we'll redraw below */
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
WinWidth = event.xconfigure.width;
WinHeight = event.xconfigure.height;
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
}
}
@@ -550,9 +491,12 @@ event_loop(Display *dpy)
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
fps);
tRate0 = t;
/* Destroy window and create new one */
XDestroyWindow(dpy, win);
make_window(dpy, "glxgears", (int)(fps * 100) % 100, (int)(fps * 100) % 100, 300, 300, &win);
make_window(dpy, "glxgears",
(int)(fps * 100) % 100, (int)(fps * 100) % 100, /* x,y */
WinWidth, WinHeight, &win);
XMapWindow(dpy, win);
frames = 0;
@@ -562,7 +506,6 @@ event_loop(Display *dpy)
}
int
main(int argc, char *argv[])
{
@@ -579,12 +522,6 @@ main(int argc, char *argv[])
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else if (strcmp(argv[i], "-stereo") == 0) {
stereo = GL_TRUE;
}
else if (strcmp(argv[i], "-fullscreen") == 0) {
fullscreen = GL_TRUE;
}
else
printf("Warrning: unknown parameter: %s\n", argv[i]);
}
@@ -596,7 +533,6 @@ main(int argc, char *argv[])
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
@@ -604,7 +540,6 @@ main(int argc, char *argv[])
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
event_loop(dpy);
XCloseDisplay(dpy);

View File

@@ -39,6 +39,12 @@
#include <GL/gl.h>
#include <GL/glx.h>
#ifndef GLX_MESA_swap_control
#define GLX_MESA_swap_control 1
typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
#endif
static int is_glx_extension_supported(Display *dpy, const char *query);
static void query_vsync(Display *dpy);
@@ -592,31 +598,22 @@ query_vsync(Display *dpy)
int interval = 0;
#ifdef GLX_MESA_swap_control
if ((interval <= 0)
&& is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
if (is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
PFNGLXGETSWAPINTERVALMESAPROC pglXGetSwapIntervalMESA =
(PFNGLXGETSWAPINTERVALMESAPROC)
glXGetProcAddressARB((const GLubyte *) "glXGetSwapIntervalMESA");
interval = (*pglXGetSwapIntervalMESA)();
} else if (is_glx_extension_supported(dpy, "GLX_SGI_swap_control")) {
/* The default swap interval with this extension is 1. Assume that it
* is set to the default.
*
* Many Mesa-based drivers default to 0, but all of these drivers also
* export GLX_MESA_swap_control. In that case, this branch will never
* be taken, and the correct result should be reported.
*/
interval = 1;
}
#endif
#ifdef GLX_SGI_video_sync
if ((interval <= 0)
&& is_glx_extension_supported(dpy, "GLX_SGI_video_sync")) {
PFNGLXGETVIDEOSYNCSGIPROC pglXGetVideoSyncSGI =
(PFNGLXGETVIDEOSYNCSGIPROC)
glXGetProcAddressARB((const GLubyte *) "glXGetVideoSyncSGI");
unsigned count;
if ((*pglXGetVideoSyncSGI)(& count) == 0) {
interval = (int) count;
}
}
#endif
if (interval > 0) {

View File

@@ -267,7 +267,8 @@ main(int argc, char *argv[])
printf(" glxheads xdisplayname ...\n");
printf("Example:\n");
printf(" glxheads :0 mars:0 venus:1\n");
h = AddHead(":0");
h = AddHead(XDisplayName(NULL));
if (h)
PrintInfo(h);
}

View File

@@ -587,6 +587,9 @@ event_loop(Display *dpy, Window win)
angle += 2.0;
draw();
glXSwapBuffers(dpy, win);
if ( get_frame_usage != NULL ) {
GLfloat temp;
@@ -594,8 +597,6 @@ event_loop(Display *dpy, Window win)
frame_usage += temp;
}
glXSwapBuffers(dpy, win);
/* calc framerate */
{
static int t0 = -1;
@@ -759,7 +760,7 @@ main(int argc, char *argv[])
Display *dpy;
Window win;
GLXContext ctx;
char *dpyName = ":0";
char *dpyName = NULL;
int swap_interval = 1;
GLboolean do_swap_interval = GL_FALSE;
GLboolean force_get_rate = GL_FALSE;

View File

@@ -158,7 +158,7 @@ main(int argc, char *argv[])
Display *dpy;
Window win;
GLXContext ctx;
char *dpyName = ":0";
char *dpyName = NULL;
int i;
for (i = 1; i < argc; i++) {

View File

@@ -108,7 +108,7 @@ def shlib_emitter(target, source, env):
return (target, source)
shlib_action = SCons.Action.Action(shlib_generator, generator=1)
shlib_action = SCons.Action.Action(shlib_generator, '$SHLINKCOMSTR', generator=1)
res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')

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