Compare commits

..

562 Commits

Author SHA1 Message Date
Brice Goglin
eef7b39a36 Prepare changelog for upload 2010-02-01 22:55:49 +01:00
Brice Goglin
04f4a8921b New upstream snapshot 2010-02-01 22:38:35 +01:00
Brice Goglin
7078992fea Merge branch 'upstream-experimental' into debian-experimental 2010-02-01 22:37:11 +01:00
Jakob Bornecrantz
f5145a6ec3 vmware/core: Remove old ioctl structs not used
Leftover that was never used in this driver
2010-01-29 17:14:53 +01:00
José Fonseca
ddedfe12d4 svga: Actually call fence_reference in texture downloads. 2010-01-29 16:23:46 +00:00
Brian Paul
cb5447f79c glsl: fix preprocessor bug involving //-style comments in macro definitions
See comments for details.
2010-01-29 08:26:23 -07:00
Brian Paul
9fd3c74724 tnl: check that state is validated before drawing 2010-01-29 08:24:36 -07:00
Brian Paul
4d1234e222 st/mesa: check that state is validated before drawing 2010-01-29 08:24:36 -07:00
Brian Paul
3cba779e16 vbo: fix missing state validation bugs
Commit 2708ddfb06 caused a few regressions.
We need to check/validate state after calling bind_arrays() because
it might set the _NEW_ARRAYS flag if the varying VP inputs change.

The symptom of this problem was some attribute arrays being ignored
(or interpreted as constant-valued) in glDrawRangeElements or
glMultiDrawElements.

A follow-on patch will add some additional asserts to try to catch
this kind of thing in the future.
2010-01-29 08:24:36 -07:00
Brian Paul
23eda89ec8 mesa: do state validation in _mesa_valid_to_render()
...rather than checking/validating before all the calls to
_mesa_valid_to_render() and valid_to_render().

The next patch will actually fix some bugs...
2010-01-29 08:24:36 -07:00
José Fonseca
6e68898b05 softpipe: Flush draw module when fragment pipeline state changes. 2010-01-28 20:22:44 +00:00
José Fonseca
1befcd5a2a softpipe: Flush draw module before switching framebuffer.
Otherwise geometry might end up in the wrong rendertarget.
2010-01-28 20:22:44 +00:00
José Fonseca
12ba355978 llvmpipe: Use assert instead of abort. Only verify functions on debug builds. 2010-01-28 20:22:43 +00:00
José Fonseca
a0907a645f llvmpipe: Fix memory leak. 2010-01-28 20:22:43 +00:00
José Fonseca
1acf7a09e7 llvmpipe: Use the generic conversion routine for depths.
This allows for z32f depth format to work correctly.
2010-01-28 20:22:43 +00:00
José Fonseca
14dc02a1b2 llvmpipe: Be more conservative with the supported formats.
We'll likely support much more formats, but doing this allows to run
more testsuites without immediately hit assertion failures.
2010-01-28 20:22:43 +00:00
José Fonseca
88cf87bd56 llvmpipe: Unmapping vertex/index buffers does NOT flush draw module anymore.
Not since 6094e79f4e.

Drivers now need to flush draw module explicitely (which explains why
all those previous commits adding draw_flushes calls were necessary).

This is a good thing, but it's tricky to get this right in face of user buffers
(it's not even clear who has the responsibility to flush when a user buffer
is seen -- statetracker or pipe driver), so just force flush (temporarily)
since it's not a bottleneck now.
2010-01-28 20:22:43 +00:00
José Fonseca
31b3420688 llvmpipe: Treat state changes systematically.
That is:
- check for no op
- update/flush draw module
- update bound state and mark it as dirty

In particular flushing the draw module is important since it may contain
unflushed primitives which would otherwise be draw with wrong state.
2010-01-28 20:22:43 +00:00
José Fonseca
4e95983fa8 llvmpipe: Flush draw module before switching framebuffer.
Otherwise geometry will end up in the wrong rendertarget.
2010-01-28 20:22:43 +00:00
José Fonseca
4e506eac8f llvmpipe: add LP_DEBUG env var
Cherry-picked from dec35d04ae.
2010-01-28 20:22:43 +00:00
Brian Paul
46167149ce llvmpipe: fix broken TGSI_OPCODE_FRC codegen 2010-01-28 20:22:42 +00:00
Brian Paul
96ec4eb755 llvmpipe: fix broken lp_build_abs() 2010-01-28 20:22:42 +00:00
José Fonseca
e20547042c llvmpipe: Fix yet another copynpaste typo in lp_build_log2_approx.
Now fslight looks perfect.
2010-01-28 20:22:42 +00:00
José Fonseca
0451d0fd01 llvmpipe: Fix lp_build_polynomial comment. 2010-01-28 20:22:42 +00:00
José Fonseca
aa8b23e077 llvmpipe: Fix typo in lp_build_log constant. 2010-01-28 20:22:42 +00:00
José Fonseca
4eb48a3af7 llvmpipe: Fix bad SI -> FP conversion into lp_build_log2_approx.
It should be a bitcast  as the integer value is actually an encoded FP
already.
2010-01-28 20:22:42 +00:00
Jakob Bornecrantz
8db8adfd01 st/xorg: Update to new libkms interface but be backwards compatible 2010-01-28 18:02:10 +01:00
Keith Whitwell
8e240d7e0e svga: remove sleep in DEBUG_FLUSH path 2010-01-28 17:13:50 +00:00
José Fonseca
40298bf272 python/retrace: Dump all vertices for verbosity level 3. 2010-01-28 17:13:49 +00:00
Brian Paul
a0518e66b2 docs: Fixed Windows build for 7.7.1 2010-01-27 17:08:03 -07:00
Brian Paul
82c76cd16f windows: assorted build fixes
These changes were originally submitted by Karl Schultz for Mesa 7.7-rc2
but weren't applied.
2010-01-27 17:04:49 -07:00
Rodolfo Ribeiro Gomes
50e890bc51 glx: fix possible memory leaks in dri2CreateScreen()
Original patch fixed up by Brian Paul.
2010-01-27 17:04:49 -07:00
Alex Deucher
bba9557019 r600: fix warning 2010-01-27 12:20:04 -05:00
Alex Deucher
2041d3e4b7 r600: rv670 support 8 tex instructions just like other r6xx
also clarify some other const values.
2010-01-27 12:19:54 -05:00
Andre Maasikas
77b7b3a1ab r600: increase max texture units to 16 2010-01-27 11:38:29 -05:00
Andre Maasikas
0dab80fbfb r600: fix XPD with writemask
same variable used for 2 different temp registers
fixes e.g. glsl/bump
2010-01-27 11:38:16 -05:00
José Fonseca
e3257912e0 mesa: Warn when indices are out of bounds, but do not skip the draw in debug builds.
The driver (or preferably the hardware) should handle out of bounds
indices.

If there are problems then it's better to detect those in the debug
builds.
2010-01-27 16:25:31 +00:00
José Fonseca
15fe491822 svga: Prevent buffer overflow in buffer ranges.
Do this by extending the nearest range to cover the new range.

This fixes an access fault in Call of Duty which was doing many disjoint
glBufferSubData calls.
2010-01-27 15:41:25 +00:00
José Fonseca
ac597f5acc svga: Fix PIPE_LOGICOP_INVERT.
Actually the current XOR implementation is an INVERT.

This fixes rectangle selection in Maya.
2010-01-27 14:45:56 +00:00
Keith Whitwell
5cb255f0d7 svga: better path for generating white pixels for xor logicop workaround 2010-01-27 14:26:48 +00:00
Brice Goglin
adcbe9af69 Prepare changelog for upload 2010-01-27 09:14:43 +01:00
Brice Goglin
527f2433fc New upstream snapshot 2010-01-27 09:14:16 +01:00
Brice Goglin
81f129113a Merge branch 'mesa_7_7_branch' of git://anongit.freedesktop.org/mesa/mesa into debian-experimental
Conflicts:
	progs/tests/getprocaddress.c
	progs/tests/vparray.c
	progs/trivial/tri-fbo-tex-mip.c
	progs/trivial/tri-fbo-tex.c
	scons/gallium.py
2010-01-27 09:12:04 +01:00
Brice Goglin
9abcffc1c6 Merge branch 'debian-unstable' into debian-experimental
Conflicts:
	debian/changelog
2010-01-27 09:09:36 +01:00
Dave Airlie
2f28ca0a27 radeon/r200/r300: don't clean non-emitted state.
So if we don't actually emit an atom to the hw because we don't
need it in the current state (e.g. lighting related atoms when
lighting is off) then don't mark it as clean, because when
lighting gets switched on we won't emit it at all.

This fixes funky gears colors.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-27 12:32:46 +10:00
Dave Airlie
0580e488da radeon: remove unused file 2010-01-27 12:32:44 +10:00
José Fonseca
5435f790fd python: Add missing library on debug builds. 2010-01-26 20:37:35 +00:00
Erik Wien
68ca19afd7 mesa: Don't bind DRAW/READ_FRAMEBUFFER separately without FBO blit support
If GL_EXT_framebuffer_blit was not supported _mesa_DeleteFramebuffersEXT
would raise an error when deleting the currently bound framebuffer. This
because it tried to bind the default DRAW- and READ_FRAMEBUFFER separately.
This patch binds the default FRAMEBUFFER instead in that case.

Encountered in the fbo/fbo-copyteximage piglit test on R600.

Patch cleaned up a bit by Brian Paul.
2010-01-26 13:19:32 -07:00
Brian Paul
cbecb8fc8e vbo: if 'end' is out of bounds, clamp it
If we determine that the 'end' parameter to glDrawElements() is out of
bounds, clamp it to the max legal index value.
2010-01-26 12:49:48 -07:00
Brian Paul
645e297a00 vbo: clamp DrawElements start/end to max possible values
Some apps are sloppy with their start/end values.  Clamp them to
max possible values to prevent problems later.
2010-01-26 12:47:54 -07:00
Brian Paul
af1e9403e7 mesa: remove redundant _MaxElement computation
Eric added some new code to check if offset < obj_size before computing
_MaxElement but my original code was still present afterward and it
clobbered the _MaxElement value.

Not sure if this came from a bad merge or what.
2010-01-26 10:53:40 -07:00
Brian Paul
1d8b308cbf docs: document Intel, R300 env vars 2010-01-26 09:12:32 -07:00
Jakob Bornecrantz
6749310d3f st/xorg: Fix crash on resize with libkms 2010-01-25 20:12:59 +01:00
Igor Oliveira
0d051af612 vega: fix incorrect samplers, textures indexes in blend_bind_samplers()
Fixes fd.o bug 25863.

Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-25 09:53:53 -07:00
Jakob Bornecrantz
6877c5de3c vmware/xorg: Do buffer round-robin logic differently 2010-01-25 12:27:47 +01:00
Jakob Bornecrantz
0b482c4fbe st/xorg: Improve options and print them to log
Set 2D acceleration to off by default
Get fallback debugging from the Xorg config
Also print if 3D acceleration is enabled
2010-01-25 11:24:56 +01:00
Jakob Bornecrantz
a3b783ea29 vmware/xorg: Export pci_probe function for ugly chain-loading 2010-01-25 11:24:55 +01:00
Jakob Bornecrantz
36fd55f9f0 st/xorg: Export helper function for detecting modesetting 2010-01-25 11:24:55 +01:00
Jakob Bornecrantz
16cf7e14a6 st/xorg: Fix warning 2010-01-25 11:24:55 +01:00
Brian Paul
47d30b0c2c st/mesa: fix int->uint conversion for negative scissor bound values
Based on a patch by Xavier Chantry <chantry.xavier@gmail.com>:

If x+width or y+height is negative, then maxx or maxy will get a bogus value
when converting that to unsigned. Fix this by setting 0 as minimal value.

This was also triggered by teeworlds, but only with some combination of
resolution and map section. For example upper part of dm2 at 1280x1024.
2010-01-24 18:18:17 -07:00
Brian Paul
e88d6fe299 mesa: move _mesa_debug() call earlier in _mesa_Scissor
Part of a patch from Xavier Chantry <chantry.xavier@gmail.com>
2010-01-24 17:54:47 -07:00
Xavier Chantry
fdfa4c8529 st/mesa: fix unsigned/signed breakage in scissor
commit 53174afeeb introduced a portability change that converted GLint x,y
to GLuint. That breaks when x and y are negative, which seems to be allowed,
and which at least one game uses : teeworlds.

Rather than simply reverting the change, it seems possible to convert the
16bit unsigned to GLint so that comparisons are made between signed integers
instead.  This hopefully does not break anything while keeping MSVC happy.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-24 16:45:49 -07:00
Vinson Lee
e85cb98a16 r200: Silence fprintf format warning. 2010-01-24 00:17:00 -08:00
Vinson Lee
e02dc13952 x86: Do not build read_rgba_span_x86.S on Mac OS X.
read_rgba_span_x86.S uses the pseudo-ops .hidden and .type which are
not recognized on Mac OS X.
2010-01-23 23:18:33 -08:00
Vinson Lee
f429b80fff x86: Do not use .hidden pseudo-op on Mac OS X.
The .hidden directive is an unknown pseudo-op on Mac OS X.
2010-01-23 23:12:34 -08:00
Vinson Lee
bc75ec0f38 glapi: Do not use .type pseudo-op on Mac OS X.
The .type directive is an unknown pseudo-op on Mac OS X.
2010-01-23 22:59:31 -08:00
Vinson Lee
6b55aacccb scons: Do not use ld options start-group and end-group on Darwin.
Mac OS X ld does not support these options.
2010-01-23 21:43:26 -08:00
Vinson Lee
d57ba16ae3 scons: Define _DARWIN_C_SOURCE on Darwin builds. 2010-01-23 21:05:58 -08:00
Vinson Lee
7f2f42dd80 progs/demos: Remove unnecessary header from shadowtex.c. 2010-01-23 20:56:49 -08:00
Vinson Lee
b62b524fee r300: Remove unnecessary headers. 2010-01-23 20:43:27 -08:00
Vinson Lee
fb6bff3712 intel: Remove unnecessary headers. 2010-01-23 14:33:29 -08:00
Vinson Lee
146a77af3f radeon: Remove unused variable. 2010-01-23 02:14:56 -08:00
Vinson Lee
4bad0aef40 tdfx: Remove unnecessary headers. 2010-01-23 01:54:53 -08:00
Vinson Lee
283d9565bf sis: Remove unnecessary headers. 2010-01-23 01:40:44 -08:00
Vinson Lee
09a142e5db savage: Remove unnecessary headers. 2010-01-23 00:38:14 -08:00
Vinson Lee
ca54a5b920 mga: Remove unnecessary headers. 2010-01-23 00:19:29 -08:00
Vinson Lee
634ec5c2ab i965: Remove unnecessary headers. 2010-01-22 23:53:39 -08:00
Vinson Lee
329c1b5910 i915: Remove unnecessary headers. 2010-01-22 23:22:16 -08:00
Julien Cristau
5aee9e344b Remove myself from Uploaders 2010-01-23 01:46:41 +01:00
Brian Paul
5e78903952 gallium/util: fix incorrect shift in a4r4g4b4_put_tile_rgba()
Fixes fd.o bug 23313.
2010-01-22 17:17:05 -07:00
Brian Paul
099e8ec54d mesa: re-implement _mesa_ProgramEnvParameter4fvARB() with memcpy()
This is faster and ensures that NaN floats get stored properly.
Before, NaN values (which might be used with UP2H, UP2US, UP4B and
UP4UB) weren't getting stored properly with gcc -O3.

This is the second part of the fix for the piglit fp-unpack-01 failure
(bug 25973).
2010-01-22 15:41:11 -07:00
Brian Paul
8d1a01d370 mesa: use new fetch_vector1ui() function for 'unpack' GPU instructions
The UP2H, UP2US, UP4B and UP4UB instructions interpret the float
registers as integers.  With gcc -O3 some bits were getting mixed up
somewhere.  This is part of the fix for the piglit fp-unpack-01 test
failure (bug 25973).
2010-01-22 15:36:38 -07:00
Brian Paul
efde2df114 xlib/softpipe: more buffer free fixes
The previous memory leak fix didn't always work properly.
Now check the xm_buffer::smh field (now documented!) to
see if the buffer points to shared memory.
2010-01-22 13:07:07 -07:00
Brian Paul
64871747bb gallium/draw: apply DRAW_PIPE_FLAG_MASK to all vertex elements
Depending on first/last provoking vertex either the first or last
element/index may have the extra DRAW_PIPE_x flags.  Mask off those
bits for all vertex elements to be safe (esp. for the quad case).
This may be overly cautious, but it's a cheap operation.

Fixes a segfault caused by large/bogus vertex indexes otherwise.
2010-01-22 11:49:51 -07:00
Brian Paul
5ab0d49a07 gallium/draw: added comments, whitespace fixes 2010-01-22 11:39:19 -07:00
Ruediger Oertel
96280c2a41 Fix PowerPC related typo in spantmp2.h
Signed-off-by: Matthias Hopf <mhopf@suse.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-22 08:07:41 -07:00
José Fonseca
383f460cf7 vmware/core: Update for pipebuffer changes.
In particular, delay patching GMR relocations until the buffers are
validated, since the buffers relative offset can only be established then.
2010-01-22 09:41:52 +01:00
Vinson Lee
3f6d732bfb st/mesa: Remove unnecessary header from st_cb_viewport.c. 2010-01-21 23:41:57 -08:00
Vinson Lee
8bc3c06d86 progs/trivial: Remove unnecessary header from tri-fbo-tex-mip.c. 2010-01-21 23:24:40 -08:00
Vinson Lee
a1c5d8f61d i915g: Remove unnecessary header. 2010-01-21 23:09:06 -08:00
Vinson Lee
cea9250ff0 pipebuffer: Remove unnecessary header. 2010-01-21 23:07:29 -08:00
Vinson Lee
dc544ad9c6 draw: Remove unnecessary headers. 2010-01-21 22:57:12 -08:00
Vinson Lee
e8b5203fbb svga: Remove unused variable. 2010-01-21 17:24:07 -08:00
José Fonseca
a626565178 vmware/core: Flush preemptively the FIFO commands to keep the GMR working set within reasonable bounds. 2010-01-21 15:51:37 -08:00
José Fonseca
beb8e8f2f2 vmware/core: Put GMR pool size in a define. 2010-01-21 15:47:52 -08:00
José Fonseca
e45579e50b vmw/wgl: Update for pipebuffer changes.
This is a minimum change to keep things building and running minimally -- it
might cause applications to fail to allocate buffers due to out of
GMR memory.

A proper update will be commited later.
2010-01-21 15:27:26 -08:00
José Fonseca
31e49dc54e svga: Remove duplicate code. 2010-01-21 15:18:40 -08:00
José Fonseca
50edefec2d svga: Remove unused code. 2010-01-21 15:18:40 -08:00
José Fonseca
9782d7cdf3 svga: Don't swap buffers to system memory -- winsys' responsibility. 2010-01-21 15:18:40 -08:00
José Fonseca
c4ceba1141 pipebuffer: Release the lock during map wait. Cleanups. 2010-01-21 15:18:40 -08:00
José Fonseca
3498616b03 pipebuffer: Swap buffers out to system memory when running out of memory. 2010-01-21 15:18:40 -08:00
José Fonseca
0bc8851884 svga: Avoid synchronization issues when doing SW TNL. 2010-01-21 15:18:40 -08:00
José Fonseca
8410f7cde3 mesa: Use pipe_buffer_write_nooverlap where appropriate. 2010-01-21 15:18:40 -08:00
José Fonseca
37246f854b util: Set DISCARD & UNSYNCHRONIZED when uploading vertices sequentially. 2010-01-21 15:18:40 -08:00
José Fonseca
1797494946 util: Use pipe_buffer_write_nooverlap in blits / mipmap generation. 2010-01-21 15:18:40 -08:00
José Fonseca
a8477fb00c gallium: New inline to write buffers which avoids synchronization. 2010-01-21 15:18:40 -08:00
José Fonseca
707b28136f gallium: Set PIPE_BUFFER_USAGE_DISCARD flag in pipe_buffer_write. 2010-01-21 15:18:40 -08:00
José Fonseca
13c2475339 gallium: Remove temporary hack for the absence of a discard flag.
PIPE_BUFFER_USAGE_DISCARD flag now exists.
2010-01-21 15:18:40 -08:00
José Fonseca
0ae076bf40 svga: Follow buffer usage semantics properly.
It's necessary to download buffers from the host always, except if the
buffer is undefined, because:
- just PIPE_BUFFER_USAGE_CPU_WRITE doesn't guarantee all data is written
  -- old contents may still pierce through
- PIPE_BUFFER_USAGE_DISCARD refers to a range, not the whole buffer, so
  unless we track which parts have been modified and not we still need
  to download the data.
2010-01-21 15:18:40 -08:00
Vinson Lee
efc08bddb7 st/xorg: Remove unnecessary headers. 2010-01-21 15:05:21 -08:00
Roland Scheidegger
2cf8164065 r200: fix CS section size mismatch
Partial fix for fdo bug 25544

The tex handling will still need CS drm changes,
see bug 25544 for more.
2010-01-21 17:33:51 -05:00
Vinson Lee
4222bf3d3c llvmpipe: Remove unnecessary headers. 2010-01-21 14:31:15 -08:00
Vinson Lee
c50fe2c55c svga: Remove unnecessary headers. 2010-01-21 12:12:11 -08:00
Vinson Lee
e19b3c01f4 mach64: Remove unnecessary headers. 2010-01-20 22:52:49 -08:00
Vinson Lee
7c66211b7d i810: Remove unnecessary headers. 2010-01-20 22:02:51 -08:00
Vinson Lee
0bc2cbf82a ffb: Remove unnecessary headers. 2010-01-20 16:27:44 -08:00
Brian Paul
a416123f5b xlib/softpipe: fix buffer memory leak
Fixes leak caused by window resize.
2010-01-20 10:34:45 -07:00
Brian Paul
65d2a26637 st/mesa: fix format logic in compatible_src_dst_formats()
We need to consider the user-requested formats, not the actual device-
chosen formats.  See code comments for more details.
2010-01-20 08:09:53 -07:00
Brian Paul
4e34c5d0b5 docs: updated Mesa mailing list info 2010-01-20 08:09:53 -07:00
Jakob Bornecrantz
9f728ed1c9 st/xorg: Fic bug and close drm_api at proper place 2010-01-20 14:55:07 +00:00
Vinson Lee
e3cb614f93 softpipe: Remove unnecessary headers. 2010-01-20 00:08:54 -08:00
Vinson Lee
ac2a665fd7 i915g: Remove unnecessary headers. 2010-01-19 22:47:03 -08:00
Jakob Bornecrantz
bea9ed4dc6 svga: Do a more propper creation of textures from handles 2010-01-19 23:30:31 +01:00
Jakob Bornecrantz
c78fe6e050 st/xorg: Don't leak BusID buffer 2010-01-19 23:30:30 +01:00
Jakob Bornecrantz
65354a7e3d st/xorg: Pass kernel driver name to drmOpen 2010-01-19 17:12:12 +01:00
Jakob Bornecrantz
a5fb5d6a54 st/drm: Expose kernel driver name
Based on patch by Chia-I Wu <olvaffe@gmail.com>

Expose the name of the kernel driver as accepted by drmOpenByName.
2010-01-19 17:10:04 +01:00
Ben Skeggs
116a02be22 st/dri: update dri2 drawables when viewport is changed
Fixes gnome-shell on nouveau, as well as window resize with various
other applications.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-19 17:06:22 +01:00
Luca Barbieri
e88294328c glx: Set GL context to null in __glXSetCurrentContextNull
__glXSetCurrentContextNull currently does not set the GL context to null
in the direct rendering case.

This can result in a segfault trying to flush an invalid old context
in glXMakeCurrent.

This fixes a crash starting the Unigine demos (they still don't work due
to missing extensions though).

Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-19 08:59:37 -07:00
José Fonseca
7a39a5c1cb wgl: Check for PIPE_TEXTURE_USAGE_DISPLAY_TARGET support in exported color pixel formats.
Since all formats we export have PFD_DRAW_TO_WINDOW flag.
2010-01-19 06:14:12 -08:00
José Fonseca
5e870f4fe9 wgl: Don't export pure-stencil pixel formats.
They cause DCT's conform to always fail.
2010-01-19 06:14:12 -08:00
José Fonseca
e5da7b8548 softpipe: Fix vertex buffer memory leak. 2010-01-19 06:14:12 -08:00
Vinson Lee
faa99dd31d unichrome: Remove unnecessary headers. 2010-01-19 00:45:16 -08:00
Vinson Lee
45a27eacd6 mesa: Remove unnecessary header from attrib.c. 2010-01-18 22:50:08 -08:00
Vinson Lee
2613fa815a mesa: Remove unnecessary header from blend.c. 2010-01-18 22:45:23 -08:00
Vinson Lee
c4ad036ce1 mesa: Remove unnecessary headers from buffers.c. 2010-01-18 22:17:03 -08:00
Vinson Lee
7366d8e7d2 mesa: Remove unnecessary header from convolve.c. 2010-01-18 21:56:58 -08:00
Vinson Lee
08063ba449 mesa: Fix typo of 'unknown' in debug.c. 2010-01-18 21:41:31 -08:00
Vinson Lee
b36b85f9d0 mesa: Remove unnecessary headers from debug.c. 2010-01-18 21:37:18 -08:00
Vinson Lee
6deb8c9831 mesa: Remove unnecessary header from depthstencil.c. 2010-01-18 21:34:25 -08:00
Vinson Lee
2660511ea9 mesa: Remove unnecessary headers from dlist.c. 2010-01-18 21:31:02 -08:00
Vinson Lee
7395ab042a mesa: Remove unnecessary header from drawpix.c. 2010-01-18 21:22:47 -08:00
Vinson Lee
0b3109aa05 mesa: Remove unnecessary header from enable.c. 2010-01-18 21:17:45 -08:00
Vinson Lee
536e3c9168 mesa: Remove unnecessary headers from fbobject.c. 2010-01-18 21:14:04 -08:00
Vinson Lee
b6dce54214 mesa: Remove unnecessary header from formats.c. 2010-01-18 21:07:53 -08:00
Vinson Lee
2cbc3e0a20 mesa: Remove unnecessary header from image.c. 2010-01-18 21:02:19 -08:00
José Fonseca
65fa11959f softpipe: Skip depth testing for PIPE_S8_UNORM. 2010-01-18 20:34:19 -08:00
José Fonseca
8fb92e96e9 mesa: Handle PIPE_FORMAT_B8G8R8X8_UNORM. 2010-01-18 20:34:19 -08:00
José Fonseca
bcadde2068 pipebuffer: Ensure buffer size/alignment is not zero. 2010-01-18 20:34:19 -08:00
José Fonseca
dc298559c6 svga: Ensure buffer size/alignment is not zero. 2010-01-18 20:34:19 -08:00
Vinson Lee
ebd1075598 mesa: Remove unnecessary headers from lines.c. 2010-01-18 19:32:51 -08:00
Vinson Lee
d0125e3c29 mesa: Remove unnecessary header from mipmap.c. 2010-01-18 19:23:47 -08:00
Vinson Lee
ed5a116eb4 mesa: Remove unnecessary header from pixel.c. 2010-01-18 19:20:56 -08:00
Vinson Lee
2f83948370 mesa: Remove unnecessary headers from pixelstore.c. 2010-01-18 19:14:23 -08:00
Vinson Lee
419ae5a483 mesa: Remove unnecessary header from points.c. 2010-01-18 19:10:05 -08:00
Vinson Lee
80ea879cfa mesa: Remove unnecessary header from polygon.c. 2010-01-18 19:03:54 -08:00
Vinson Lee
6603550353 mesa: Remove unnecessary header from state.c. 2010-01-18 18:54:54 -08:00
Vinson Lee
ec29ba12a6 mesa: Remove unnecessary headers from texcompress.c. 2010-01-18 18:52:24 -08:00
Vinson Lee
f8db32acbd st/dri: Add comment for intentional fallthrough in case statement. 2010-01-18 18:14:03 -08:00
Brian Paul
28576c9ac5 st/mesa: change instruction count assertion to > 0
Shaders should at least have an END instruction.
2010-01-18 11:26:57 -07:00
Marcin Slusarz
e978b24c87 st/dri: fix optionCache memory leaks
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-18 10:48:06 -07:00
Marcin Slusarz
23ae318200 glxgears: unbind current context before "destroying" it
glXDestroyContext does not destroy the context if it's still
connected to some window. Unbind context from window to test it.

Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-18 10:44:53 -07:00
Julien Cristau
b1a8810204 Rename the build directory to not include DEB_BUILD_GNU_TYPE for no good reason. Thanks, Colin Watson! 2010-01-16 16:48:55 +00:00
Jakob Bornecrantz
ccc888c39e st/xorg: If dri2 version is 2 support version 1 as well
Thanks to X server commit 2e2c5b216cc1c7a9bc26bd2c68226aaed5fc52ca
it is possible to be ABI compatible in version 2 with version 1 of
the DRI2 interface.
2010-01-15 01:38:04 +00:00
Jakob Bornecrantz
3e1241d4f8 st/xorg: Set enforce version to 1 if not defined 2010-01-15 01:38:04 +00:00
Thomas Hellstrom
ae97520e37 ws/vmware: Check DRM version also when bootstrapping in dri2 mode.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-01-18 15:56:57 +01:00
Thomas Hellstrom
5f2d60a715 st/dri: Don't request a fake front if the server adds one automatically.
We use the presence of the getBuffersWithFormat extension function to
detect whether the server automatically adds a front.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-01-18 13:39:25 +01:00
Vinson Lee
d773f28ff2 mesa: Remove unnecessary headers from texformat.c. 2010-01-18 00:47:56 -08:00
Vinson Lee
39824945fa mesa: Remove unnecessary headers from texgetimage.c. 2010-01-18 00:14:51 -08:00
Vinson Lee
6938dccf1a mesa: Remove unnecessary header from teximage.c. 2010-01-17 22:31:53 -08:00
Vinson Lee
c847e7d07b mesa: Remove unnecessary header from texobj.c. 2010-01-17 20:50:15 -08:00
Vinson Lee
59eed7a201 mesa: Remove unnecessary header from texparam.c. 2010-01-17 16:21:11 -08:00
Vinson Lee
3e876431d0 mesa: Remove unnecessary headers from texstate.c. 2010-01-17 16:08:59 -08:00
Vinson Lee
6b6ac9aca0 mesa: Use preprocessor to comment out code. 2010-01-17 15:48:39 -08:00
Vinson Lee
ae943f8e20 mesa: Remove unnecessary headers from vtxfmt.c. 2010-01-17 01:49:16 -08:00
Vinson Lee
97e44cde17 mesa: Remove unnecessary headers from arbprogparse.c. 2010-01-16 23:41:05 -08:00
Vinson Lee
97fc7ae69f mesa: Remove unnecessary header from nvvertparse.c. 2010-01-16 16:15:37 -08:00
Vinson Lee
5a4d5b694c glsl: Remove unnecessary header from prog_execute.c. 2010-01-16 16:06:58 -08:00
Vinson Lee
148498d8cc glsl: Remove unnecessary header from prog_statevars.c. 2010-01-16 15:51:52 -08:00
Vinson Lee
0d62242082 glsl: Remove unnecessary headers from shader_api.c. 2010-01-16 15:35:56 -08:00
Vinson Lee
1f7762f62b glsl: Remove unnecessary header from slang_emit.c. 2010-01-16 15:00:29 -08:00
Vinson Lee
89950fbe24 st/mesa: Remove unnecessary header from st_cb_drawpixels.c. 2010-01-16 13:29:15 -08:00
Vinson Lee
59db91e2ee glsl: Remove unnecessary header from slang_builtin.c. 2010-01-16 02:20:51 -08:00
Vinson Lee
535084996b glsl: Remove unnecessary headers from slang_compile.c. 2010-01-16 02:16:24 -08:00
Vinson Lee
1d3bdc2090 glsl: Remove unnecessary header from slang_link.c. 2010-01-16 02:02:49 -08:00
Vinson Lee
10bd931949 glsl: Remove unnecessary header from slang_log.c. 2010-01-16 01:50:08 -08:00
Vinson Lee
533b6e8deb st/mesa: Remove unnecessary header from st_atom_framebuffer.c. 2010-01-16 01:39:04 -08:00
Vinson Lee
3eb85bf7d9 st/mesa: Remove unnecessary header from st_atom_pixeltransfer.c. 2010-01-16 00:52:34 -08:00
Vinson Lee
bc639f291b st/mesa: Remove unnecessary header from st_atom_sampler.c. 2010-01-16 00:45:36 -08:00
Vinson Lee
227fc5a308 st/mesa: Remove unnecessary header from st_atom_shader.c. 2010-01-16 00:36:31 -08:00
Vinson Lee
cc2f2268f5 st/mesa: Remove unnecessary headers from st_cb_accum.c. 2010-01-16 00:30:25 -08:00
Vinson Lee
e1d4781cd4 st/mesa: Remove unnecessary headers from st_cb_bitmap.c. 2010-01-16 00:08:54 -08:00
Vinson Lee
cc770c8409 st/mesa: Remove unnecessary headers from st_cb_blit.c. 2010-01-15 23:17:00 -08:00
Vinson Lee
6906bf08cc st/mesa: Remove unnecessary headers from st_cb_clear.c. 2010-01-15 23:02:07 -08:00
Vinson Lee
668d871d95 st/mesa: Remove unnecessary headers from st_cb_drawpixels.c. 2010-01-15 22:55:47 -08:00
Alex Deucher
adcde22952 r600: fill in some missing XRGB tex formats 2010-01-15 23:04:19 -05:00
Alex Deucher
81eed59a2c r600: set tiling correctly for texturing from depth buffer 2010-01-15 23:04:09 -05:00
Alex Deucher
114ab07aee r600: fix typo in SQ setup 2010-01-15 23:04:00 -05:00
Vinson Lee
56cd5806e8 st/mesa: Remove unnecessary header from st_cb_fbo.c. 2010-01-15 18:24:12 -08:00
Vinson Lee
a9f6255431 st/mesa: Remove unnecessary headers from st_cb_feedback.c. 2010-01-15 18:20:56 -08:00
Vinson Lee
2d2d890048 st/mesa: Remove unnecessary header from st_cb_program.c. 2010-01-15 16:28:56 -08:00
Vinson Lee
fbda223893 st/mesa: Remove unnecessary header from st_cb_queryobj.c. 2010-01-15 16:27:28 -08:00
Brian Paul
f595e72337 tgsi: fix detection of front-facing attribute
This code was not updated when we added TGSI_SEMANTIC_FACE a while ago.
2010-01-15 14:57:58 -07:00
Brian Paul
2c5aa02e20 swrast: add missing call to _swrast_depth_bounds_test()
We were calling this from the CI span function, but not the RGBA
span function.

I don't know of a test program for the GL_EXT_depth_bounds_test
extension...
2010-01-15 14:25:33 -07:00
Brian Paul
7385681797 swrast: fix broken _swrast_depth_clamp_span()
The integer Z clamping range depends on the number of bits
in the Z buffer because that's the scale factor used when we
transform NDC coords by the viewport/depth range.

Fixes fd.o bug #25972 but only for Z buffers up to a depth
of 30 bits.  Beyond that we get into messy integer overflow
issues and things fall apart.
2010-01-15 14:19:25 -07:00
Vinson Lee
79a5a28390 st/mesa: Remove unnecessary header from st_cb_rasterpos.c. 2010-01-14 23:05:42 -08:00
Vinson Lee
9c2ef74a76 st/mesa: Remove unnecessary headers from st_cb_readpixels.c. 2010-01-14 23:03:37 -08:00
Vinson Lee
cde041cd13 st/mesa: Remove unnecessary header from st_cb_strings.c. 2010-01-14 22:30:00 -08:00
Vinson Lee
644572a372 st/mesa: Remove unnecessary headers from st_cb_texture.c. 2010-01-14 22:27:13 -08:00
Vinson Lee
4f8baf7dce st/mesa: Remove unnecessary headers from st_cb_viewport.c. 2010-01-14 19:00:27 -08:00
Vinson Lee
53c6c38412 st/mesa: Remove unnecessary headers from st_context.c. 2010-01-14 18:53:51 -08:00
Vinson Lee
604e9ec2c4 st/mesa: Remove unnecessary header from st_draw_feedback.c. 2010-01-14 18:46:51 -08:00
Vinson Lee
9e7778d7aa st/mesa: Remove unnecessary header from st_extensions.c. 2010-01-14 18:34:59 -08:00
Vinson Lee
8a8a27b01a st/mesa: Remove unnecessary header from st_format.c. 2010-01-14 18:19:39 -08:00
Vinson Lee
eaedc1bb3e st/mesa: Remove unnecessary headers from st_framebuffer.c. 2010-01-14 18:10:06 -08:00
Vinson Lee
6890b06982 st/mesa: Remove unnecessary headers from st_gen_mipmap.c. 2010-01-14 17:54:47 -08:00
Vinson Lee
252812bf15 st/mesa: Remove unnecessary header from st_program.c. 2010-01-13 23:28:00 -08:00
Vinson Lee
c109ca9c49 st/mesa: Remove unnecessary header from st_texture.c. 2010-01-13 23:16:05 -08:00
Vinson Lee
6b39e8aeb0 swrast: Remove unnecessary header from s_accum.c. 2010-01-13 23:01:03 -08:00
Vinson Lee
78411881d3 swrast: Remove unnecessary header from s_atifragshader.c. 2010-01-13 22:58:07 -08:00
Vinson Lee
0a70868131 swrast: Remove unnecessary header from s_bitmap.c. 2010-01-13 22:45:54 -08:00
Vinson Lee
886cffb44e swrast: Remove unnecessary headers from s_copypix.c. 2010-01-13 22:43:16 -08:00
Vinson Lee
cf061c24e0 swrast: Remove unnecessary header from s_depth.c. 2010-01-13 22:36:01 -08:00
Vinson Lee
d1631f734a swrast: Remove unnecessary header from s_drawpix.c. 2010-01-13 22:30:04 -08:00
Vinson Lee
f649870c9b swrast: Remove unnecessary header from s_feedback.c. 2010-01-13 22:20:44 -08:00
Thomas Hellstrom
a9086f2d17 st/dri: Make sure we always request a fake front.
This should be the correct, but sub-optimal way to handle things on
pre-1.7 servers. For servers that automatically adds a fake front
we should never request the fake front and handle the reply differently.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-01-13 17:45:21 +01:00
José Fonseca
1b333453e4 svga: Fix compile_vs error code.
It could erroneously return PIPE_OK in some circumstances.

Make compile_fs code identical.
2010-01-13 13:40:09 +00:00
Vinson Lee
831764fa75 swrast: Remove unnecessary header from s_fragprog.c. 2010-01-12 23:54:15 -08:00
Vinson Lee
d6588a9372 swrast: Remove unnecessary header in s_lines.c. 2010-01-12 21:59:58 -08:00
Vinson Lee
7debc532d5 swrast: Remove unnecessary header from s_points.c. 2010-01-12 21:51:19 -08:00
Vinson Lee
11034bfa97 swrast: Remove unnecessary header from s_readpix.c. 2010-01-12 21:41:09 -08:00
Vinson Lee
a01b9eac04 swrast: Remove unnecessary header from s_texcombine.c. 2010-01-12 20:36:33 -08:00
Vinson Lee
c239f38709 tnl: Remove unnecessary header from t_context.c. 2010-01-12 20:14:36 -08:00
Vinson Lee
2c7cf3f9c9 tnl: Remove unnecessary headers from t_draw.c. 2010-01-12 20:02:44 -08:00
Vinson Lee
dffcbee8e7 tnl: Remove unnecessary header from t_pipeline.c. 2010-01-12 19:55:24 -08:00
Vinson Lee
a24d852630 tnl: Remove unnecessary header from t_rasterpos.c. 2010-01-12 19:49:19 -08:00
Vinson Lee
264f4101cd tnl: Remove unnecessary header from t_vb_program.c. 2010-01-12 19:45:25 -08:00
Vinson Lee
c631501003 vbo: Remove unnecessary headers from vbo_exec.c. 2010-01-12 17:07:24 -08:00
Vinson Lee
94d238e757 vbo: Remove unnecessary header from vbo_exec_array.c. 2010-01-12 16:55:36 -08:00
Vinson Lee
37d326503d vbo: Remove unnecessary header from vbo_exec_draw.c. 2010-01-12 16:37:30 -08:00
Vinson Lee
aee9a6f4e1 vbo: Remove unnecessary headers from vbo_save.c. 2010-01-12 00:50:05 -08:00
Vinson Lee
d2271d8a39 vbo: Remove unnecessary header from vbo_save_loopback.c. 2010-01-11 23:53:13 -08:00
Vinson Lee
083dae14bd vbo: Remove unnecessary header from vbo_split_copy.c. 2010-01-11 22:46:30 -08:00
Vinson Lee
0d65a68f51 x86: Remove unnecessary header from x86_xform.c. 2010-01-11 21:04:16 -08:00
Vinson Lee
8e9ceb8309 progs/xdemos: Remove unnecessary header from corender.c. 2010-01-11 20:24:57 -08:00
Vinson Lee
477d51537f progs/trivial: Remove unnecessary headers from tri-fbo-tex.c. 2010-01-11 20:21:50 -08:00
Vinson Lee
7241f5140f progs/trivial: Remove unnecessary header from tri-fbo-tex-mip.c. 2010-01-11 20:15:59 -08:00
Vinson Lee
ae8ed89f24 progs/tests: Remove duplicate included header in vparray.c. 2010-01-11 19:58:08 -08:00
Vinson Lee
6ed607cce6 progs/tests: Add newline to end of printf in vparray.c. 2010-01-11 19:56:04 -08:00
Vinson Lee
7bfa54c6a4 progs/redbook: Remove unnecessary header from aapoly.c. 2010-01-11 19:52:22 -08:00
Vinson Lee
2178abfba3 progs/glsl: Remove duplicate included header from shtest.c. 2010-01-11 19:42:55 -08:00
Vinson Lee
78ddce9fda progs/demos: Remove unnecessary header from morph3d.c. 2010-01-11 19:29:26 -08:00
Brian Paul
3fce8ad2de Revert "util: Build u_bitmask.o when using make."
This reverts commit 01eff0e6d2.

u_bitmask.c was already in the C_SOURCES list.
2010-01-11 20:19:30 -07:00
Vinson Lee
f07e87ffba progs/tests: Silence fprintf format warning. 2010-01-11 19:16:36 -08:00
Vinson Lee
b4bc208529 progs/demos: Remove unnecessary header from isosurf.c. 2010-01-11 19:03:18 -08:00
Zack Rusin
d880b64423 st/xorg: move exaMoveInPixmap before trying to fetch it
as Michel suggested, this is a cleaner way of fixing crashes caused
by exaGetPixmapDriverPrivate returning null since the data hasn't
been moved yet.
2010-01-11 18:27:59 -05:00
Zack Rusin
3447d545d9 st/xorg: fix a rare video crash
sometimes dst isn't present if a window is in a middle of a resize, stop
crashing in those cases and just ignore a frame.
2010-01-11 18:03:49 -05:00
Brice Goglin
2b5f0b8669 Prepare changelog for upload 2010-01-11 17:52:44 +01:00
Brice Goglin
5be25443dd Merge branch 'debian-unstable' of git+ssh://git.debian.org/git/pkg-xorg/lib/mesa into debian-experimental
Conflicts:
	ChangeLog
	debian/changelog
2010-01-11 17:52:13 +01:00
Brice Goglin
eb1cc8273b New upstream release 2010-01-11 17:49:26 +01:00
Brice Goglin
5144f580d0 Merge branch 'upstream-experimental' into debian-experimental
Conflicts:
	progs/egl/eglgears.c
	progs/egl/eglscreen.c
	progs/fp/Makefile
	progs/fp/SConscript
	progs/rbug/simple_server.c
	progs/tests/getprocaddress.c
	progs/tests/interleave.c
	progs/tests/texwrap.c
	progs/tests/vparray.c
	progs/vp/vp-tris.c
	src/glut/glx/win32_menu.c
2010-01-11 17:47:52 +01:00
Brice Goglin
4afc359cc3 Revert "Bump the libdrm build-dep to 2.4.17 because of the changed radeon API."
This reverts commit ed7cd35ba0.

Only libdrm 2.4.15 is uploaded in Debian for now.
2010-01-11 17:44:11 +01:00
Vinson Lee
6d6c9c6688 progs/demos: Remove unnecessary header from fbotexture.c. 2010-01-11 00:24:39 -08:00
Dave Airlie
efaba97eaa radeon: fix prediction for r100 inline vert/elt emits.
On r100 we emit the indices inline so we need to account
for that in the emission size.
2010-01-11 13:27:20 +10:00
Dave Airlie
1294df9ca4 radeon: fix bug in realloc code.
This bug was fixed in libdrm ages ago, port to non-kms
2010-01-11 13:27:14 +10:00
Vinson Lee
4fe51c7447 glu/sgi: Initialize members of class Mesher. 2010-01-10 16:09:41 -08:00
Vinson Lee
1111b38a1b glu/sgi: Initialize members of class Slicer. 2010-01-10 15:55:52 -08:00
Vinson Lee
b9bd96608c glu/sgi: Include missing header file. 2010-01-10 03:03:14 -08:00
Vinson Lee
199dedd6dd progs/demos: Check upper bounds of input in manywin.c. 2010-01-10 01:57:13 -08:00
Vinson Lee
0c7814fe23 progs/demos: Bounds check input to fire.c. 2010-01-10 00:40:46 -08:00
Vinson Lee
9e98c1fbf6 glu/sgi: Initialize members of class Renderhints. 2010-01-10 00:14:33 -08:00
Vinson Lee
a5815c36f7 glu/sgi: Initialize members of class StoredVertex. 2010-01-09 23:55:05 -08:00
Vinson Lee
61afd1158f glu/sgi: Include missing header file. 2010-01-09 23:53:54 -08:00
Vinson Lee
f8737bda37 glu/sgi: Initialize member of class O_pwlcurve. 2010-01-09 23:25:49 -08:00
Vinson Lee
683e3cb8db progs/tests: Silence 'missing initializer' warnings. 2010-01-08 23:08:57 -08:00
Vinson Lee
223c8482ca progs/glsl: Silence uninitialized variable warning. 2010-01-08 22:10:52 -08:00
Vinson Lee
3b82de92a0 progs/demos: Add missing initializers in engine.c. 2010-01-08 22:02:49 -08:00
Vinson Lee
4775723d2f r300g: Silence unused variable warnings. 2010-01-08 21:43:54 -08:00
Vinson Lee
20d6360db7 tgsi: Silence uninitialized variable warnings. 2010-01-08 20:24:05 -08:00
Timo Aaltonen
ed7cd35ba0 Bump the libdrm build-dep to 2.4.17 because of the changed radeon API. 2010-01-09 02:24:49 +02:00
Jakob Bornecrantz
61f7252448 Revert "pipebuffer: Multi-threading fixes for fencing."
This reverts commit 5b64d94390.
2010-01-07 05:14:20 +01:00
Thomas Hellstrom
cb51f02678 Revert "st/dri: no need to request fake front buffer, only handle it being returned"
This reverts commit 1336989ec6.

The commit breaks frontbuffer rendering and the possibility to do
on-demand frontbuffer requests on all Xservers prior to 1.7.

The commit should be conditioned on a dri2 version check.
I've submitted a patch to Xserver to bump dri2 minor, and it's acked by Ian.

To be able to check the version from within the state tracker, we will
probably need another dri2 extension function that returns the server
version. The protocol has support for it.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-01-11 21:36:51 +01:00
Thomas Hellstrom
01eff0e6d2 util: Build u_bitmask.o when using make.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-01-11 21:36:51 +01:00
Jakob Bornecrantz
de37a00d27 util: Add u_bitmask to make build 2010-01-06 15:32:42 +01:00
Dan Nicholson
674c76310f mesa: Ensure libmesagallium.a is finished building before descending
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
2010-01-08 06:09:19 -08:00
Vinson Lee
3c42e403de r300: Move initial declaration outside for loop. 2010-01-08 01:13:46 -08:00
Brian Paul
5dd9e23d62 docs: document Gallium SSE codegen for XPD bug fix 2010-01-07 14:55:27 -07:00
Brian Paul
8647aa1d8d tgsi: fix SSE code emit for XPD
Rearrange things so that the writes to the dest registers happen
after we've fetched/used all src registers.

The problematic instruction was:  XPD TEMP[2].xyz, TEMP[0], TEMP[2];
Note that the dst reg is also a src reg.

This fixes bad shading with progs/glsl/bump.c since Eric's changes to the
Mesa program optimizer in commit d6690ce15f.
The optimizer rearranges some registers so we occasionally wind up with
something like the above.
2010-01-07 14:49:14 -07:00
Brian Paul
2b7a4b2c0e progs/fp: remove invalid tri-inv.c test
INV is not a valid instruction.
2010-01-07 08:22:39 -07:00
Vinson Lee
d42467687e progs/demos: Assert that input to malloc is valid. 2010-01-06 21:39:44 -08:00
Vinson Lee
45ac10fe6a progs/xdemos: Check for string overflow. 2010-01-06 18:19:46 -08:00
Vinson Lee
25ffd76278 progs/xdemos: Check for string overflow. 2010-01-06 18:08:41 -08:00
Vinson Lee
468f270f3f svga: Silence uninitialized variable warning. 2010-01-06 17:51:08 -08:00
Brian Paul
ef7eb62423 meta: remove F suffix from _mesa_Ortho() params
_mesa_Ortho() takes GLdoubles.
2010-01-06 18:22:06 -07:00
Brian Paul
73bd400016 docs: document a mipmap generation bug fix 2010-01-06 18:20:17 -07:00
Brian Paul
cb3cb96fbd meta: move destination vertex/projection setup out of _mesa_meta_GenerateMipmap
Based on a patch submitted by Pierre Willenbrock <pierre@pirsoft.de>
2010-01-06 18:20:17 -07:00
Brian Paul
06970b2ccb meta: set viewport and projection matrix in _mesa_meta_GenerateMipmap
This fixes mipmap levels being clipped to the last viewport.

Based on a patch submitted by Pierre Willenbrock <pierre@pirsoft.de>
2010-01-06 18:20:17 -07:00
Andre Maasikas
49653c01e8 r600: adjust after radeon mipmap changes in 7118db8700
R600_OUT_BATCH_RELOC doesn't really use offset so set it
in TEX_RESOURCE2
+ typo fix
2010-01-06 19:52:24 -05:00
Brian Paul
8485811f10 tnl: set FOGC result to (f,0,0,1)
Fixed FDO bug 23397.
2010-01-06 17:43:56 -07:00
Vinson Lee
4c45810d57 progs/xdemos: Remove comma at end of enumerator list. 2010-01-06 15:35:18 -08:00
Vinson Lee
96a4e4552d progs/xdemos: Use temporary variables.
This was missed from the previous commit to glxheads.c.
2010-01-06 15:33:13 -08:00
Vinson Lee
c1dad22d71 progs/glsl: Prevent possible string overflow. 2010-01-06 15:25:42 -08:00
Vinson Lee
f4952f040b progs/xdemos: Prevent possible string overflow. 2010-01-06 14:56:43 -08:00
Pierre Ossman
c9befda13a r600: float texture component ordering
The ordering of texture components was
backwards for the floating point textures.

Signed-off-by: Pierre Ossman <pierre@ossman.eu>
2010-01-06 12:42:49 -05:00
Roel Kluin
324568f79d mesa: test index bounds before array element
Check whether the index is within bounds before accessing the array.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-06 09:47:37 -07:00
Roel Kluin
5db710a823 win32_menu: add missing parentheses in mapMenu()
`|' has higher precedence than `?'.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-06 09:46:55 -07:00
Roel Kluin
2b4acd26b1 nv50: add missing parentheses in nv50_query_result()
NOUVEAU_BO_RD is defined (1 << 2), and `|' has higher precedence than `?'
so the second argument of nouveau_bo_map was always 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-06 09:46:53 -07:00
Brian Paul
e4b7d9ea35 i965: fix invalid assertion in emit_xpd(), again 2010-01-06 07:18:09 -07:00
José Fonseca
5b64d94390 pipebuffer: Multi-threading fixes for fencing.
I had this patch on my hard drive for long time. It doesn't fully
address SVGA multi-threading issues, but causes no regressions, so decided
to commit while it still applies cleanly.

Attention: merging this into master will cause issues due to recent
changes in reference counting to fix strict aliasing rules violation.
2010-01-06 12:18:16 +00:00
Brian Paul
e555146fa3 i965: fix invalid assertion in emit_xpd()
Invalid assertion found by Roel Kluin <roel.kluin@gmail.com>
2010-01-05 15:53:05 -07:00
Roel Kluin
766f3ccbda tdfx: condition always evaluates to false in SetupDoubleTexEnvVoodoo3()
This can never be true.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
2010-01-05 14:42:28 -07:00
Brian Paul
9f544394c1 st/mesa: fix broken translation of negative register indexes
A src register's index can be negative if we're doing indirect
addressing into the constant buffer.  Ex: MOV OUT[1], CONST[ADDR[0].x-3]

This fixes the piglit vp-arl-neg-array.vpfp test.

Before this change we were going out of bounds of the t->constants[]
array and getting garbage that later triggered an assertion.
2010-01-05 11:44:19 -07:00
Brian Paul
487a14b476 ARB prog parser: regenerated parser file 2010-01-05 11:44:19 -07:00
Brian Paul
f0f68b1e4c ARB prog parser: fix parameter binding type
References to program local and enviroment parameters are put into the
unified program parameters list as PROGRAM_STATE_VAR entries which point
into the local or environment arrays.  So the param_binding_type field
should be PROGRAM_STATE_VAR.

This fixes the piglit vpfp-generic vp-arl-env-array.vpfp and
vp-arl-local-array.vpfp test failures.
2010-01-05 11:44:19 -07:00
Brian Paul
e3514b7338 ARB prog parser: regenerated parser files 2010-01-05 11:44:19 -07:00
Brian Paul
7c6ae4c6c8 ARB prog parser: add allowSwizzle param to initialize_symbol_from_const()
We need to disable constant consolidation when building an array of
constants which might be indexed indirectly.

Fixes regression in piglit vpfp-generic vp-arl-constant-array.vpfp
test caused by earlier constant consolidation patch.
2010-01-05 11:44:19 -07:00
Brian Paul
37f6929d29 mesa: whitespace changes and comments 2010-01-05 11:44:19 -07:00
Brian Paul
f27e39aa4e mesa: change constant search behaviour in _mesa_add_unnamed_constant()
Only search for an existing, matching constant if swizzleOut is non-null.
We need to be able to disable constant consolidation when building an
array of constants which will be indexed indirectly.
2010-01-05 11:44:19 -07:00
José Fonseca
38d8b18003 svga: Remove stale references to delete shader results.
To ensure that a new result that happens to have the same address
of the old one will be detected as a change.
2010-01-05 17:56:26 +00:00
José Fonseca
8ebef37c7b svga: Rebind shaders when tokens change.
Even shader ID doesn't change. Otherwise the token change is not
effective.

This reverts regression from commit
cdb445f3a9. Regression could be seen in
Quake3's loading screen -- the upper right corner of the screen would
be black.
2010-01-05 17:32:53 +00:00
Brian Paul
ef1b942691 st/mesa: added PROGRAM_LOCAL_PARAM case in src_register()
Fixes piglit vpfp-generic arl.vpfp failure when using gallium.
2010-01-05 09:14:50 -07:00
Brian Paul
bd96b51303 mesa: bump version to 7.7.1-DEVEL 2010-01-05 07:59:29 -07:00
Brian Paul
6d84580858 mesa: add missing _mesa_lock_texture() call 2010-01-04 19:05:31 -07:00
Eric Anholt
b434a816d7 i915: Use _MaxLevel on principle in texture setup.
It was OK before because we proceed to clamp the value to hardware
limits, but given that other use of MaxLevel has been a trap, let's
avoid it.
2010-01-04 14:15:12 -08:00
Eric Anholt
19a26dfc47 intel: Fix CopyTexImage from tiled mipmap levels > 0.
Fixes piglit fbo-copyteximage.
2010-01-04 14:15:12 -08:00
Eric Anholt
63610fae4f i965: Fix the surface offset calculation for tiled buffers.
If we ever had a non-tile-aligned tiled renderbuffer, the math was all
off.  Use the existing x,y coordinates instead of trying to
reconstruct them from an incorrectly-calculated offset value.
2010-01-04 14:15:12 -08:00
Andre Maasikas
a160d1c27d r600: support vertex_array_bgra
Use vertex program key mechanism and swizzle during vertex fetch - is there
a better way?
2010-01-04 16:16:43 -05:00
Brian Paul
82421c549f mesa: added GL_DU8DV8_ATI in extract_float_rgba()
Fixes warning seen with Shadowgrounds.  See bug 24016.
2010-01-04 14:01:19 -07:00
Brian Paul
01bf004d8b docs: initial release notes for 7.7.1 2010-01-04 14:01:18 -07:00
Vinson Lee
6130bb1391 mesa: Prevent possible array out-of-bounds access by _mesa_light. 2010-01-04 12:06:04 -08:00
Brian Paul
e661bf5018 mesa: regenerated enums.c file 2010-01-04 11:30:03 -07:00
Brian Paul
707faf65c8 glapi: comment-out TIMEOUT_IGNORED
This is not really a GLenum value.
2010-01-04 11:30:03 -07:00
Brian Paul
f52dd2ab33 glsl: use varName variable in _slang_gen_assignment() 2010-01-04 11:30:03 -07:00
Michel Dänzer
1e414df894 st/mesa: Only call st_texture_image_unmap() if texImage->Data is non-NULL.
This was already done in st_TexImage() but was missed between incremental
changes to st_TexSubimage().
2010-01-04 16:54:29 +01:00
Michel Dänzer
acd1451393 svga: Fix debug build crash when rendering to depth/stencil renderbuffer only. 2010-01-04 13:05:43 +01:00
Michel Dänzer
c114f000df st/xorg: Proper calculation of screen pitch. 2010-01-04 13:04:05 +01:00
Michel Dänzer
8282185752 vmware/xorg: Fix SCons build. 2010-01-04 13:02:40 +01:00
Vinson Lee
d1e2fc19cc r300: Use C-style comments. 2010-01-03 23:33:32 -08:00
Vinson Lee
8a29e3f8e8 progs/egl: Silence uninitialized variable warnings. 2010-01-03 21:39:20 -08:00
Vinson Lee
3ea5a95078 progs/samples: Silence compiler warnings. 2010-01-03 21:29:33 -08:00
Vinson Lee
b14cbfaebc r300: Silence 'mixed declarations and code' warnings. 2010-01-03 20:51:23 -08:00
Vinson Lee
0214b7b3c1 r300: Silence 'mixed declarations and code' warning. 2010-01-03 20:16:59 -08:00
Vinson Lee
58531029e6 r300: Silence 'mixed declarations and code' warning. 2010-01-03 18:32:07 -08:00
Vinson Lee
3e196f433d r300g: Silence 'mixed declarations and code' warning. 2010-01-03 18:05:12 -08:00
Vinson Lee
fe3ea299bf r300g: Remove comma at end of enumerator list. 2010-01-03 15:07:35 -08:00
Vinson Lee
0bfc579bd4 llvmpipe: Remove comma at end of enumerator list. 2010-01-03 14:42:36 -08:00
José Fonseca
eb5d9e6f70 mesa: Cope with the degenerate case of zero length ranges.
Fixes assertion failures on glean's bufferObject test.
2010-01-03 20:00:19 +00:00
José Fonseca
f3739bdb60 gdi: Don't generate import libraries for opengl32.dll.
Both MinGW and MSVC include opengl32 import libraries, and its safer to
always use those.
2010-01-03 20:00:19 +00:00
Jeremy Huddleston
287cbba9b7 apple: Purge existing (not working) GLX_USE_APPLEGL from dated libGL on OSX
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
2010-01-03 08:58:13 -05:00
Jeremy Huddleston
32305e3a9f glxcmds: Fix comment about __DRI_ALLOCATE
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
2010-01-03 08:58:13 -05:00
Vinson Lee
1d95544446 trace: Remove comma at end of enumerator list. 2010-01-03 03:08:40 -08:00
José Fonseca
66c1de77ed rtasm: Play nicely with Windows's Data Execution Prevention. 2010-01-03 11:03:13 +00:00
Vinson Lee
1da47ac20e progs/vp: Ensure null-terminated byte string. 2010-01-03 02:38:22 -08:00
Vinson Lee
c9c6e9a39e progs/tests: Silence uninitialized variable warning. 2010-01-02 21:58:40 -08:00
Vinson Lee
32d18924df progs/tests: Silence warn_unused_result warning. 2010-01-02 21:52:51 -08:00
Vinson Lee
d27effbfd8 i810: Fix include recursion. 2010-01-02 21:05:06 -08:00
Vinson Lee
94c5faad26 sis: ifdef out unused variable.
Silences GCC warning.
2010-01-02 20:47:15 -08:00
Vinson Lee
d2758f3b74 st/xorg: Ensure null-terminated byte string. 2010-01-02 20:39:04 -08:00
Vinson Lee
be6fb5c083 r300g: Use C-style comments. 2010-01-02 20:17:43 -08:00
Vinson Lee
fe27b07b0f glu/sgi: Initialize members of struct O_curve. 2010-01-02 20:04:00 -08:00
José Fonseca
cdb445f3a9 svga: Use a shader id as low as possible. 2010-01-03 00:50:13 +00:00
José Fonseca
904917dcc6 util: Minor enhancements/corrections to the bitmask logic. 2010-01-03 00:50:13 +00:00
José Fonseca
da6a80301b svga: Rename error labels.
Make it easier to insert/remove error branches.
2010-01-03 00:50:12 +00:00
Vinson Lee
386f91eec3 glu/sgi: Initialize members of struct O_surface. 2010-01-02 15:46:11 -08:00
Vinson Lee
ba9dc26eec glu/sgi: Initialize member of struct O_trim. 2010-01-02 15:29:25 -08:00
Vinson Lee
37e5626111 glu/sgi: Initialize member of struct Property. 2010-01-01 23:01:03 -08:00
Vinson Lee
646c8ce032 progs/samples: 'Silence no previous prototype' warnings. 2010-01-01 17:54:11 -08:00
Vinson Lee
2c64e4c50e glu/sgi: Initialize member of struct Dlnode. 2010-01-01 17:25:16 -08:00
Vinson Lee
64a1961011 glu/sgi: Initialize members of struct O_nurbscurve. 2010-01-01 17:19:27 -08:00
Vinson Lee
fab161f287 x86: Silence printf format warnings. 2010-01-01 17:06:16 -08:00
Vinson Lee
ad9defdd9c progs/rbug: s/wait/rbug_wait/
wait conflicts with wait in /usr/include/sys/wait.h.
2010-01-01 16:25:37 -08:00
Vinson Lee
3ae37da611 llvmpipe: Silence uninitialized variable warning. 2010-01-01 16:03:53 -08:00
Vinson Lee
fd237a879f llvmpipe: Use C-style comment. 2010-01-01 15:38:19 -08:00
Vinson Lee
dac82c378a gallium/util: Silence format warnings. 2010-01-01 15:32:52 -08:00
Vinson Lee
88bd32383a ARB prog parser: Silence unused variable warnings. 2010-01-01 15:12:58 -08:00
Vinson Lee
7df06e7e9d gallium/util: Replace h_addr with h_addr_list[0].
Fixes compilation error on Mac OS.
2010-01-01 15:01:22 -08:00
Vinson Lee
a349687d49 glu/sgi: Initialize members of class Knotvector. 2010-01-01 14:46:30 -08:00
Vinson Lee
5d3d202ac9 glu/sgi: Initialize member of struct Property. 2010-01-01 14:39:16 -08:00
Brian Paul
195e7657e2 swrast: use different temp array in _swrast_get_dest_rgba()
When using multiple color drawbuffers with blending/logicop/masking we
were overwriting color values which we still needed.
2009-12-31 08:44:27 -07:00
Vinson Lee
6e0584932b mesa: Silence unused variable warning. 2009-12-31 00:07:47 -08:00
Vinson Lee
5b2713c92a progs/glsl: Provide a better fix for fgets warning. 2009-12-30 12:38:21 -08:00
Brian Paul
f00bf0598c st/mesa: add PIPE_FORMAT_Z24S8_UNORM in st_get_format_info()
Fixes progs/demos/fbotexture on Nouveau.
Patch submitted by Luca Barbieri <luca@luca-barbieri.com>.
2009-12-29 23:31:43 -07:00
Vinson Lee
de95e5768b glu/sgi: Initialize members of struct O_nurbssurface. 2009-12-29 22:29:53 -08:00
Vinson Lee
ac21edff1c tdfx: Silence uninitialized variable warning. 2009-12-29 21:34:06 -08:00
Vinson Lee
0ab29d2b35 progs/glsl: Silence compiler warnings. 2009-12-29 21:11:37 -08:00
Vinson Lee
70bbe22366 glu/sgi: Silence warn_unused_result warnings. 2009-12-29 21:03:23 -08:00
Vinson Lee
31263f41a0 st/xorg: Use C-style comments. 2009-12-29 20:56:47 -08:00
Vinson Lee
97b899374c glu/sgi: Initialize member of struct GridVertex. 2009-12-29 20:45:24 -08:00
Jakob Bornecrantz
5169775345 st/xorg: Fix warning and add a TODO comment 2009-12-30 05:08:41 +01:00
Jakob Bornecrantz
d34fdf149d st/xorg: On close wait on fences and then destroy the screen 2009-12-30 05:01:09 +01:00
Jakob Bornecrantz
5fdc4f732f st/xorg: Be proper with pipe pointers on close in exa 2009-12-30 05:00:30 +01:00
Jakob Bornecrantz
53e314cb80 st/xorg: Make sure we don't overrun the fence array in block handler 2009-12-30 04:22:12 +01:00
Vinson Lee
3bcf7d7d7b glu/sgi: Initialize member variables in class Varray. 2009-12-29 17:46:42 -08:00
Vinson Lee
a7db305c2f glu/sgi: Initialize member of class monoChain. 2009-12-29 17:35:22 -08:00
Vinson Lee
5060fb428d glu/sgi: Initialize members of class sampledLine. 2009-12-29 17:22:11 -08:00
Vinson Lee
495b8f8f7a glu/sgi: Initialize members of class directedLine. 2009-12-29 14:28:33 -08:00
Vinson Lee
62a0d4ef7f mesa: Initialize variable in get_tex_color_index. 2009-12-29 13:38:02 -08:00
Brian Paul
4f481cb87a glsl: added uniform initializer check
GLSL 1.10 disallows initializers for uniforms but GLSL 1.20 and later
allows them.  This patch uses the #version directive to allow/disallow
uniform initializers.

This addresses bug 25807, but piglit also needs to be fixed to specify
the GLSL version in the shader.
2009-12-29 10:11:29 -07:00
Brian Paul
639e7a140e ARB prog parser: use _mesa_add_unnamed_constant() to use fewer constant slots
This function will search the constant parameters in an effort to re-use
constant slots.  For example, {1,2,3,4} and {4,1,1,2} can be stored in
one constant slot and accessed with different swizzles.  The swizzle info
must be propogated though the parsing code in a few places.

Fixes Piglit "vpfp-generic tests/shaders/generic/big-param.vpfp" failure.
2009-12-29 09:08:02 -07:00
Julien Cristau
53d395336d Prepare changelog for upload 2009-12-29 10:42:29 +00:00
Julien Cristau
bc94d48259 Update patch stack
Drop hunk from 05_hurd-ftbfs.diff that was applied upstream.
Refresh other patches.
2009-12-29 10:40:05 +00:00
Julien Cristau
fabfd3eaca Bump linux-libc-dev build-dep to 2.6.31 for the r600 dri driver
fixes ftbfs on mips
2009-12-29 10:19:48 +00:00
Julien Cristau
089e2e656c Bump changelogs 2009-12-29 10:17:41 +00:00
Julien Cristau
7030b61d99 Merge branch 'mesa_7_6_branch' of git://anongit.freedesktop.org/mesa/mesa into debian-unstable
Conflicts:
	progs/tests/bug_texstore_i8.c
	progs/tests/crossbar.c
	progs/tests/cva.c
	progs/tests/fptest1.c
	progs/tests/invert.c
	progs/tests/packedpixels.c
	progs/tests/quads.c
	progs/tests/scissor-viewport.c
	progs/tests/scissor.c
	progs/tests/stencilwrap.c
	progs/tests/tex1d.c
	progs/tests/texcomp_image.h
	progs/tests/unfilledclip.c
	progs/tests/vpeval.c
	progs/trivial/clear-fbo-tex.c
	progs/trivial/createwin.c
	progs/trivial/dlist-begin-call-end.c
	progs/trivial/draw2arrays.c
	progs/trivial/drawarrays.c
	progs/trivial/tri-blend-max.c
	progs/trivial/tri-blend-min.c
	progs/trivial/tri-blend-revsub.c
	progs/trivial/tri-blend-sub.c
	progs/trivial/tri-blend.c
	progs/trivial/tri-fbo-tex.c
	progs/trivial/tri-fp.c
	progs/trivial/tri-logicop-none.c
	progs/trivial/tri-logicop-xor.c
	progs/trivial/tri-z.c
	progs/trivial/vbo-drawarrays.c
	progs/trivial/vbo-noninterleaved.c
	scons/gallium.py
	scons/generic.py
2009-12-29 10:16:21 +00:00
Vinson Lee
b4658dbf04 st/egl: Move declaration before code. 2009-12-28 19:09:33 -08:00
Vinson Lee
c67bb15d4e intel: Silence compiler warnings. 2009-12-28 18:46:15 -08:00
Vinson Lee
46c2196de3 llvmpipe: Fix assert. 2009-12-28 18:07:09 -08:00
Vinson Lee
e049ddb754 llvmpipe: Silence compiler warnings. 2009-12-28 18:05:30 -08:00
Keith Whitwell
f0ba7d897d util: better fix for unused variable warnings with asserts
Modify the non-debug (ie disabled) version of assert to expose the
value in the expression to the compiler (avoiding the unused variable
messages) while still expanding to a noop.
2009-12-28 11:06:11 +00:00
Vinson Lee
31d1822473 llvmpipe: Silence compiler warnings. 2009-12-28 00:44:30 -08:00
Vinson Lee
c441386b0c st/xorg: Silence unused variable warnings. 2009-12-27 23:02:55 -08:00
Vinson Lee
aa0437532e g3dvl: Silence compiler warnings. 2009-12-27 22:49:49 -08:00
Vinson Lee
bf63b9d7a9 st/vega: Silence compiler warnings. 2009-12-27 22:39:31 -08:00
Vinson Lee
9d3092d134 gallium/xlib: Silence unused variable warning. 2009-12-27 22:18:18 -08:00
Vinson Lee
d1f64fa72f trace: Silence unused variable warnings. 2009-12-27 18:12:58 -08:00
Vinson Lee
f31f9cf485 i915g: Silence unused variable warning. 2009-12-27 18:09:58 -08:00
Vinson Lee
3a2f96f18a softpipe: Silence unintialized variable warnings. 2009-12-27 18:06:02 -08:00
Vinson Lee
180ccffe55 softpipe: Silence unused variable warning. 2009-12-27 17:52:47 -08:00
Vinson Lee
0463ee64e3 tgsi/ureg: Silence uninitialized variable warnings. 2009-12-27 17:40:48 -08:00
Brian Paul
b0d5e44f24 docs: insert 7.7 release date 2009-12-27 15:33:25 -07:00
Brian Paul
d0b7ff551a Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
Conflicts:
	src/gallium/auxiliary/util/u_network.c
	src/gallium/auxiliary/util/u_network.h
	src/gallium/drivers/i915/i915_state.c
	src/gallium/drivers/trace/tr_rbug.c
	src/gallium/state_trackers/vega/bezier.c
	src/gallium/state_trackers/vega/vg_context.c
	src/gallium/state_trackers/xorg/xorg_crtc.c
	src/gallium/state_trackers/xorg/xorg_driver.c
	src/gallium/winsys/xlib/xlib_brw_context.c
	src/mesa/main/mtypes.h
2009-12-27 15:31:08 -07:00
Brian Paul
da876fa3a5 docs: insert 7.6.1 release date 2009-12-27 15:14:25 -07:00
Brian Paul
7831515e69 st/mesa: add missing case for PIPE_FORMAT_B8G8R8A8_UNORM 2009-12-27 10:09:24 -07:00
Vinson Lee
331e910b5c gallium/util: Remove comma at end of enumerator list. 2009-12-26 16:22:25 -08:00
Vinson Lee
3c2fd1bae0 rbug: Remove comma at end of enumerator list. 2009-12-26 16:18:47 -08:00
Vinson Lee
f8ca25e02f rbug: Remove comma at end of enumerator list. 2009-12-26 16:14:39 -08:00
Vinson Lee
fc11424bcd mesa: Remove comma at end of enumerator list. 2009-12-26 16:09:41 -08:00
Vinson Lee
309c156bae i915: Fix assert. 2009-12-26 15:55:38 -08:00
Vinson Lee
e81fe088f4 progs/demos: Silence warn_unused_result warnings. 2009-12-26 01:08:26 -08:00
Vinson Lee
cdc69e3469 progs/util: Silence warn_unused_result warnings. 2009-12-25 23:13:50 -08:00
Vinson Lee
cd59e6f553 intel: Silence implicit function declaration warning. 2009-12-25 22:34:35 -08:00
Vinson Lee
67a4abcc3b glu/sgi: Fix include recursion.
arcsorter.h should not include itself.
2009-12-25 14:23:10 -08:00
Julien Cristau
36461f0d66 Delete some files not present in tarballs 2009-12-25 19:48:46 +01:00
Julien Cristau
5e20a66515 Bump changelogs 2009-12-25 17:06:27 +01:00
Julien Cristau
12251b4915 Merge remote branch 'upstream/mesa_7_7_branch' into debian-experimental
Conflicts:
	progs/tests/bug_texstore_i8.c
	progs/tests/crossbar.c
	progs/tests/cva.c
	progs/tests/fptest1.c
	progs/tests/invert.c
	progs/tests/packedpixels.c
	progs/tests/quads.c
	progs/tests/scissor-viewport.c
	progs/tests/scissor.c
	progs/tests/stencilwrap.c
	progs/tests/tex1d.c
	progs/tests/unfilledclip.c
	progs/tests/vpeval.c
	progs/trivial/clear-fbo-tex.c
	progs/trivial/createwin.c
	progs/trivial/dlist-begin-call-end.c
	progs/trivial/draw2arrays.c
	progs/trivial/drawarrays.c
	progs/trivial/tri-blend-max.c
	progs/trivial/tri-blend-min.c
	progs/trivial/tri-blend-revsub.c
	progs/trivial/tri-blend-sub.c
	progs/trivial/tri-blend.c
	progs/trivial/tri-fbo-tex.c
	progs/trivial/tri-fp.c
	progs/trivial/tri-logicop-none.c
	progs/trivial/tri-logicop-xor.c
	progs/trivial/tri-z.c
	progs/trivial/vbo-drawarrays.c
	progs/trivial/vbo-noninterleaved.c
	src/glut/glx/glut_menu.c
2009-12-25 16:25:56 +01:00
Julien Cristau
addd04c255 Don't include GLUT sources since we don't use them. 2009-12-25 16:19:26 +01:00
Julien Cristau
2596bd88d7 Add freedesktop.org ftp to watch file since that's where newer upstream tarballs are. 2009-12-25 16:13:38 +01:00
Vinson Lee
2447786ed0 i965: Fix assert. 2009-12-24 22:58:05 -08:00
Vinson Lee
f5ad1d0d02 i965: Add missing va_end. 2009-12-24 16:26:09 -08:00
Vinson Lee
098f10c270 glsl: Initialize member a_obj of struct slang_operation. 2009-12-23 18:00:06 -08:00
Vinson Lee
261c3cd530 glu/sgi: Initialize variable in directedLine. 2009-12-23 17:50:02 -08:00
Vinson Lee
520955a0cd gallium/util: Initialize variable in util_clear. 2009-12-23 16:22:03 -08:00
Vinson Lee
6138145b35 glu/sgi: Silence compiler warnings. 2009-12-23 16:11:10 -08:00
Vinson Lee
51dcea2aac util: Ensure debug_dump_flags generates a null-terminated string. 2009-12-23 15:19:45 -08:00
Vinson Lee
2ea061509d st/xorg: Use C-style comments. 2009-12-23 14:52:06 -08:00
Vinson Lee
15ecd0337e st/vega: Move declaration outside for loop. 2009-12-23 14:43:53 -08:00
Vinson Lee
1b0ab3e3c9 st/egl: Use C-style comments. 2009-12-23 14:18:11 -08:00
Vinson Lee
6c8c1ce78b glx: Add XF86DRI[Open|Close]FullScreen prototypes to xf86dri.h. 2009-12-23 14:09:36 -08:00
Vinson Lee
cf3bb0cf31 glx: Move declaration outside for loop. 2009-12-23 12:42:38 -08:00
Tom Fogal
f42c861f02 Regenerate gl_mangle.h.
Signed-off-by: Brian Paul <brianp@vmware.com>
2009-12-23 11:38:14 -07:00
Maarten Maathuis
8e8502bc63 gallium: only create pipe buffer when size is nonzero
- This fixes a crash upon starting spring (a rts engine/game).

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
2009-12-23 16:33:54 +00:00
Vinson Lee
57b5ca5d11 glu/sgi: Silence uninitialized variable warnings. 2009-12-22 23:07:00 -08:00
Vinson Lee
19a40524d3 Add gallium to darwin config. 2009-12-22 18:21:41 -08:00
Vinson Lee
aae32df718 xlib: Use C-style comments. 2009-12-22 17:51:58 -08:00
Vinson Lee
b20382d477 trace: Silence uninitialized variable warnings. 2009-12-22 17:34:39 -08:00
Vinson Lee
f6ca26e5a7 trace: Add PIPE_OS_APPLE. 2009-12-22 17:17:28 -08:00
Vinson Lee
6ce28a755c gallium/util: Add PIPE_OS_APPLE to u_stream_stdc.c. 2009-12-22 16:23:00 -08:00
Vinson Lee
5e73bcb396 gallium/util: Add PIPE_OS_APPLE to u_network. 2009-12-22 15:59:50 -08:00
Vinson Lee
fb8bff341e i915g: Use C-style comment. 2009-12-22 15:19:48 -08:00
Vinson Lee
cf02484fb6 glx: Compile dri2.c only if GLX_DIRECT_RENDERING is defined. 2009-12-22 14:51:12 -08:00
Vinson Lee
c1033299e8 ffb: Silence compiler warnings. 2009-12-22 14:28:40 -08:00
Brian Paul
b5ddc7821a mesa: fix binary() function, printf format string
Need to use the constant 1ULL and 0xllx format string.  This fixes incorrect
results and a NULL pointer/parameter bug.
2009-12-22 13:33:40 -07:00
Vinson Lee
1bf2d78b11 progs/tests: Fix build. 2009-12-22 00:54:34 -08:00
Ian Romanick
82184970d3 Add MD5 checksums for 7.6.1 release 2009-12-21 18:43:09 -08:00
Ian Romanick
e9b5ed1c13 Add MD5 checksums for 7.6.1 release 2009-12-21 18:32:32 -08:00
Ian Romanick
6ffed19993 Add MD5 checksums for 7.7 release 2009-12-21 18:30:35 -08:00
Ian Romanick
7e210b9337 mesa: set version string to 7.7 2009-12-21 18:28:32 -08:00
Ian Romanick
164b583852 intel: Bump driver date to reflect status as final Q4 driver RC 2009-12-21 18:27:50 -08:00
Ian Romanick
48302e9b30 Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
Conflicts:
	scons/gallium.py
	scons/generic.py
	src/mesa/main/version.h
2009-12-21 18:27:24 -08:00
Ian Romanick
75ad099d3c mesa: set version string to 7.6.1 2009-12-21 18:25:30 -08:00
Vinson Lee
982acbddab progs/perf: Fix MSVC build.
(cherry picked from commit cbf46ed670)
2009-12-21 18:10:44 -08:00
José Fonseca
09415ca234 mesa: Fix missing finite symbol error on Windows.
Caused by some weird logic regarding the __WIN32__ define which made
the finite definition dependent on the header include order.
(cherry picked from commit 622bdecabd)
2009-12-21 17:56:25 -08:00
Michal Krol
de7021b71c mesa: Include <unistd.h> only when one is available.
(cherry picked from commit 970823978c)
2009-12-21 17:55:13 -08:00
Vinson Lee
2b7b2b90e3 scons: Define _USE_MATH_DEFINES on MSVC. 2009-12-21 17:25:03 -08:00
Brian Paul
b57abd3bea Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
Conflicts:
	configure.ac
	progs/demos/morph3d.c
	progs/demos/textures.c
	progs/glsl/shtest.c
	progs/glsl/texaaline.c
	progs/tests/packedpixels.c
	progs/xdemos/corender.c
	src/mesa/main/version.h
2009-12-21 18:23:53 -07:00
Fabio Pedretti
bf064ce0c3 configure.ac: fix for libdrm_radeon API changes. 2009-12-22 10:44:53 +10:00
Fabio Pedretti
e46ad402f1 configure.ac: fix for libdrm_radeon API changes. 2009-12-22 10:44:28 +10:00
Dave Airlie
bd9e0ebaff radeon/r600: use new libdrm_radeon api 2009-12-22 10:25:47 +10:00
Dave Airlie
bce03f7174 radeon: drop assert accessing cref which is meant to be hidden 2009-12-22 10:25:05 +10:00
Dave Airlie
34671efa29 radeon: drop unused members of radeon_state. 2009-12-22 10:24:57 +10:00
Dave Airlie
e77bfc436d r600: move structs for legacy cmdbuf into cmdbuf C file.
these really shouldn't be exposed here
2009-12-22 10:24:47 +10:00
Dave Airlie
9373287a1b radeon/r600: use new libdrm_radeon api 2009-12-22 10:23:41 +10:00
Dave Airlie
9d2910ee0f radeon: drop assert accessing cref which is meant to be hidden 2009-12-22 10:23:41 +10:00
Dave Airlie
43d8727301 radeon: drop unused members of radeon_state. 2009-12-22 10:23:40 +10:00
Dave Airlie
1703628011 r600: move structs for legacy cmdbuf into cmdbuf C file.
these really shouldn't be exposed here
2009-12-22 09:58:33 +10:00
Vinson Lee
07b54fe35b progs/redbook: Silence compiler warnings. 2009-12-21 15:20:01 -08:00
Brian Paul
fdae39c289 progs/perf: added check for GL_ARB_framebuffer_object 2009-12-21 13:49:25 -07:00
Brian Paul
79e74cda73 progs/demos: report pixel rate in million pixels / sec 2009-12-21 13:49:25 -07:00
Dave Airlie
753f0a1dea r600: fix glFrontFace(GL_CW)
fd.o bug #25290

Suggested fix from Rafael Monica
2009-12-21 10:40:19 -05:00
Younes Manton
ace937f165 st/mesa: Check for single level mipmap trees.
The assert in util_gen_mipmap() caught it, although
it does the right thing anyway.
2009-12-21 00:59:06 -05:00
Jeremy Huddleston
b96a5df514 darwin: mklib: Use lipo rather than file to figure out architectures of object files
(cherry picked from commit ad7f9d71e2)
2009-12-20 21:36:41 -08:00
Jeremy Huddleston
f926eff263 darwin: Cleanup CPPFLAGS a bit
(cherry picked from commit 4a1e103858)
2009-12-20 21:36:39 -08:00
Vinson Lee
0dd9513874 progs/tests: Silence compiler warnings. 2009-12-20 01:01:00 -08:00
Vinson Lee
d87d71036c progs/trivial: Use C-style comments. 2009-12-19 00:28:01 -08:00
Vinson Lee
3340fd65fb progs/xdemos: Use C-style comment. 2009-12-19 00:00:56 -08:00
Vinson Lee
695adf41e2 progs/demos: Silence compiler warning in morph3d.c. 2009-12-18 23:46:14 -08:00
Vinson Lee
121ff55d81 progs/glsl: Use C-style comments. 2009-12-18 23:38:15 -08:00
Vinson Lee
41377942d3 progs/demos: Use C-style comment. 2009-12-18 23:34:28 -08:00
Brian Paul
0478b745fe glsl: clear out shader code before compiling
When we start compiling a shader, first free the existing gl_program.
This (mostly) fixes the piglit glsl-reload-source test.
Without this change, we were actually appending the new GPU code
onto the previous program.
2009-12-18 11:57:17 -07:00
Alex Deucher
20ee275974 r600: Invert front face winding when rendering to FBO
fixes fdo bug 25679

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2009-12-16 16:18:22 -05:00
Ian Romanick
aeea8a07b8 mesa: set version string to 7.6.1-rc4 2009-12-16 10:13:41 -08:00
Brian Paul
8a09e6e2ad mesa: add missing semicolon
See bug 25663.
2009-12-16 10:39:26 -07:00
Brian Paul
35ff190a9c docs: document 7.6.1 BlueGene fixes 2009-12-16 08:17:43 -07:00
Brian Paul
138d639ec9 mesa: test for __blrts for CPU_TO_LE32()
See bug 25663.
2009-12-16 08:04:25 -07:00
Brian Paul
a43fc39585 mesa: no dlopen on BlueGene
See bug 25663.
2009-12-16 08:02:56 -07:00
Brian Paul
6f202b53b0 mesa: remove //-style comments 2009-12-16 07:58:54 -07:00
Brian Paul
ddfc2e7439 st/mesa: remove //-style comments 2009-12-16 07:58:54 -07:00
Vinson Lee
dc0a1ebc73 unichrome: Silence compiler warnings. 2009-12-15 17:39:30 -08:00
Vinson Lee
a60457b03b sis: Silence compiler warnings. 2009-12-15 17:06:01 -08:00
Vinson Lee
7e3825abdb savage: Silence compiler warnings. 2009-12-15 16:32:51 -08:00
Vinson Lee
ca02109e91 r128: Silence uninitialized variable warnings in r128_tris.c. 2009-12-15 13:12:12 -08:00
Vinson Lee
7430c3ac35 dri: Initialize variable in driBindContext. 2009-12-15 13:04:25 -08:00
Ian Romanick
f23d01e726 intel: Fallback to software if drawable size is > MaxRenderbufferSize
This prevents the mystery blank window if, for example, glxgears is
resized larger than 2048 wide on 915.  Since the Intel drivers in Mesa
7.6 lack GTT mapped fallbacks, the performance is a slideshow at
best.  On Mesa 7.7 and later the performance is much better.
2009-12-15 12:37:09 -08:00
Vinson Lee
987e9188d2 x86: ifdef out unused function cptr. 2009-12-15 12:32:48 -08:00
Matthew Bell
22d2547ad1 mesa: Add missing $(DESTDIR) support to src/gallium/winsys/xlib/Makefile 2009-12-14 21:58:19 -07:00
Vinson Lee
0a8d508854 progs/trivial: Silence compiler warnings. 2009-12-14 18:11:57 -08:00
Vinson Lee
6e5fe39f50 mga: Silence uninitialized variable warnings. 2009-12-14 17:30:15 -08:00
Vinson Lee
b18fa9f448 mach64: Silence uninitialized variable warnings. 2009-12-14 17:20:34 -08:00
Brice Goglin
35994294ea Bump libdrm build dependency to 2.4.15 2009-12-14 09:20:38 +01:00
Vinson Lee
6c9870b54c i810: Silence uninitialized variable warnings in i180tris.c 2009-12-13 00:14:31 -08:00
Vinson Lee
555dc25c4c swrast: Silence uninitialized variable warnings in s_triangle.c 2009-12-12 23:47:32 -08:00
Vinson Lee
aa44efb045 st/mesa: Silence uninitialized variables warnings in st_draw.c. 2009-12-12 22:17:16 -08:00
Vinson Lee
0aef54ba62 swrast: Silence uninitialized variable warnings in ss_tritmp.h. 2009-12-12 22:00:19 -08:00
Vinson Lee
89d85e8170 glut: Prevent potential double free in menuVisualSetup. 2009-12-12 21:46:13 -08:00
Vinson Lee
20590b9733 t_dd_dmatmp.h: Silence unused value warning in render_poly_elts. 2009-12-12 20:20:02 -08:00
Vinson Lee
cd1a09e3bb glsl: Initialize member label of struct slang_operation to NULL. 2009-12-12 18:42:18 -08:00
Vinson Lee
f8d4ac56f7 softpipe: Initialize source in blend_quad. 2009-12-12 18:34:15 -08:00
Vinson Lee
7ea452dd35 t_dd_dmatmp2.h: Silence unused value warnings. 2009-12-12 16:56:07 -08:00
Vinson Lee
75e8dbb235 i915g: Silence unused value warning in intel_drm_get_device_id. 2009-12-12 16:24:25 -08:00
Vinson Lee
9dc018618d t_dd_dmatmp.h: Silence unused value warnings in render_line_loop_elts. 2009-12-12 16:18:08 -08:00
Vinson Lee
af4e4a73f7 t_dd_dmatmp.h: Silence unused value warning in render_tri_fan_elts. 2009-12-12 16:02:09 -08:00
Vinson Lee
588e9f69c4 progs/trivial: Silence compiler warnings in tri-blend-min.c. 2009-12-12 15:47:17 -08:00
Vinson Lee
de9132f274 t_dd_dmatmp.h: Silence unused value warning in render_poly_verts. 2009-12-12 15:27:30 -08:00
Vinson Lee
1e444c9960 swrast: Initialize tex_coords in handle_sample_op. 2009-12-12 15:08:01 -08:00
Vinson Lee
c1d361bd0b t_dd_dmatmp.h: Silence unused value warning in render_quads_verts. 2009-12-12 14:41:35 -08:00
Vinson Lee
786899f153 progs/trivial: Silence compiler warnings in tri-blend-max.c 2009-12-12 14:20:17 -08:00
Vinson Lee
7d529736b9 t_dd_dmatmp.h: Silence unused value warning in render_tri_fan_verts. 2009-12-12 13:39:39 -08:00
Vinson Lee
c2cee7741e t_dd_dmatmp.h: Silence unused value warning in render_line_loop_verts. 2009-12-12 12:52:02 -08:00
Vinson Lee
15c6558a2e progs/xdemos: Silence compiler warnings in glxinfo.c. 2009-12-12 02:06:51 -08:00
Vinson Lee
d5be33477e progs/tests: Silence compiler warnings in vpeval.c. 2009-12-12 01:34:33 -08:00
Vinson Lee
44d6ab6de5 progs/tests: Silence compiler warnings in cva.c. 2009-12-12 01:11:56 -08:00
Vinson Lee
9e2eee4ab2 progs/redbook: Silence compiler warnings in aaindex.c. 2009-12-12 01:02:16 -08:00
Vinson Lee
81dcf8bdf2 t_dd_dmatmp.h: Silence unused value warning in render_line_loop_verts. 2009-12-12 00:33:42 -08:00
Thomas Hellstrom
f44f6473e6 st/xorg Fail early if we don't intend to accelerate.
Saves a number of unneeded computations and log noise.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2009-12-08 12:50:27 +01:00
Jeremy Huddleston
189ee75abb darwin: mklib: Use lipo rather than file to figure out architectures of object files
(cherry picked from commit ad7f9d71e2)
2009-12-20 21:36:58 -08:00
Jeremy Huddleston
da5741cf53 darwin: Cleanup CPPFLAGS a bit
(cherry picked from commit 4a1e103858)
2009-12-20 21:36:56 -08:00
Eric Anholt
6785d6741d i915: Fix GL_TEXTURE_MAX_LEVEL support (piglit levelclamp test). 2009-12-18 20:35:57 -08:00
Eric Anholt
b51e0fafdf i915: Clean up some unnecessary x/y miptree code.
The base of the texture is always the base of the miptree.  If it wasn't,
we'd have issues with this code due to miptrees not walking the same
direction for all LODs.
2009-12-18 20:35:57 -08:00
Eric Anholt
f06c8bd8dd i965: Add support for OPCODE_CMP in the VS to fix GLSL sqrt()
Bug #25628.  Fixes piglit case glsl-vs-sqrt-zero.
2009-12-18 20:35:57 -08:00
Keith Whitwell
325f045c04 st/mesa: move assert on nr vs insns until after pos_invarient expansion
It is possible to have a 1-instruction vertex shader before expanding
pos_invarient.  Not sure what this assert achieved, but at least move
it where it is correct.
2009-12-18 18:39:44 +00:00
Jakob Bornecrantz
5e6fff7ac4 svga: Do the gallium intel configure trick for svga as well
Since the drivers we produce on systems where we use
configure depend on none stable kernel API the driver
deliverables should not be built by default in the
mesa 7.7 release.

People wishing to shoot them self in the foot have to
pull the trigger themself, we just hand them the gun.
2009-07-19 09:29:14 +02:00
Ian Romanick
bf75ee9ccc mesa: set version string to 7.7-rc3 2009-12-16 09:15:09 -08:00
Ian Romanick
006a526edb Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
Conflicts:
	src/mesa/drivers/dri/unichrome/via_ioctl.c
	src/mesa/drivers/dri/unichrome/via_screen.c
	src/mesa/main/version.h
	src/mesa/state_tracker/st_atom.c
2009-12-16 09:09:51 -08:00
Ian Romanick
42d9409873 mesa: set version string to 7.6.1-rc4 2009-12-16 09:01:58 -08:00
Ian Romanick
11522b74b3 Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
Conflicts:
	src/gallium/drivers/softpipe/sp_quad_blend.c
2009-12-15 12:38:01 -08:00
Ian Romanick
b90f7f3ad3 i965: Use current draw buffer instead of drawable visual to get alpha bits
Use the currently bound draw buffer instead of the visual from the
drawable used to create the context.  This cause problems generating
mipmaps for an RGBA texture in an RGB context.

This fixes the failure in piglit's glsl-lod-bias test reported in bug #25614.
2009-12-14 16:30:53 -08:00
Jakob Bornecrantz
f4de0b176d vmwgfx: Update vmwgfx_drm.h to the on upstream 2009-12-14 22:27:08 +01:00
Jakob Bornecrantz
fb06d8f097 vmware/xorg: Use new stream ioctl 2009-12-14 22:12:20 +01:00
Brian Paul
69346c56a1 mesa/meta: move BindTexture() call in _mesa_meta_GenerateMipmap()
This is a follow-up to commit e3fa700c17.

The call to _mesa_BindTexture() must be before we set any other texture
object state, namely the _mesa_TexParameteri() calls.

This fixes bug 25601 (piglit gen-nonzero-unit failure).
2009-12-14 13:39:21 -07:00
Jakob Bornecrantz
48888b918b vmware/xorg: Fix failure paths and add some debug printing 2009-12-12 20:02:34 +01:00
Jakob Bornecrantz
49e4b624e5 vmwgfx/core: Check for 3D via the get param ioctl 2009-12-12 18:37:16 +01:00
Maciej Cencora
8413a3aefa radeon: fix #25463
This is just a workaroung until we properly fix texture mapping in radeonSpanRenderStart
2009-12-12 02:02:53 +01:00
Maciej Cencora
f1900323ea r300: fix depth textures 2009-12-11 23:56:47 +01:00
931 changed files with 22687 additions and 131820 deletions

30359
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@@ -182,7 +182,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.7-rc2
VERSION=7.7.1-devel
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)

View File

@@ -110,6 +110,8 @@ if platform in ('posix', 'linux', 'freebsd', 'darwin'):
'PTHREADS',
'HAVE_POSIX_MEMALIGN',
])
if platform == 'darwin':
env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
env.Append(CPPPATH = ['/usr/X11R6/include'])
env.Append(LIBPATH = ['/usr/X11R6/lib'])
env.Append(LIBS = [

View File

@@ -724,22 +724,10 @@ case $ARCH in
# examine first object to determine ABI
set ${OBJECTS}
ABI_PPC=`file $1 | grep ' ppc'`
ABI_I386=`file $1 | grep ' i386'`
ABI_PPC64=`file $1 | grep ' ppc64'`
ABI_X86_64=`file $1 | grep ' x86_64'`
if [ "${ABI_PPC}" ] ; then
OPTS="${OPTS} -arch ppc"
fi
if [ "${ABI_I386}" ] ; then
OPTS="${OPTS} -arch i386"
fi
if [ "${ABI_PPC64}" ] ; then
OPTS="${OPTS} -arch ppc64"
fi
if [ "${ABI_X86_64}" ] ; then
OPTS="${OPTS} -arch x86_64"
fi
ABIS=`lipo -info $1 | sed s/.*://`
for ABI in $ABIS; do
OPTS="${OPTS} -arch ${ABI}"
done
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}

View File

@@ -12,10 +12,10 @@ X11_DIR = $(INSTALL_DIR)
CC = gcc
CXX = g++
PIC_FLAGS = -fPIC
DEFINES = -D_DARWIN_C_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L \
-D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS \
DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
-DGLX_ALIAS_UNSUPPORTED -DGLX_INDIRECT_RENDERING
# -D_GNU_SOURCE - for src/mesa/main ...
# -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx/x11
# -DGLX_USE_APPLEGL - supposed to be used with GLX_DIRECT_RENDERING to use AGL rather than DRM, but doesn't compile
# -DIN_DRI_DRIVER
@@ -49,7 +49,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
# omit glw lib for now:
SRC_DIRS = glx/x11 mesa glu glut/glx glew
SRC_DIRS = glx/x11 mesa gallium glu glut/glx glew
GLU_DIRS = sgi
DRIVER_DIRS = osmesa
#DRIVER_DIRS = dri

View File

@@ -10,7 +10,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=7
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

@@ -19,6 +19,7 @@ AC_CANONICAL_HOST
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.15
LIBDRM_RADEON_REQUIRED=2.4.17
DRI2PROTO_REQUIRED=1.99.3
dnl Check for progs
@@ -577,7 +578,7 @@ dri)
GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
if test "$HAVE_LIBDRM_RADEON" = yes; then
RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
@@ -1200,13 +1201,15 @@ dnl
dnl Gallium SVGA configuration
dnl
AC_ARG_ENABLE([gallium-svga],
[AS_HELP_STRING([--disable-gallium-svga],
[build gallium SVGA @<:@default=enabled@:>@])],
[AS_HELP_STRING([--enable-gallium-svga],
[build gallium SVGA @<:@default=disabled@:>@])],
[enable_gallium_svga="$enableval"],
[enable_gallium_svga=yes])
[enable_gallium_svga=auto])
if test "x$enable_gallium_svga" = xyes; then
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
elif test "x$enable_gallium_svga" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
fi
dnl

45
debian/changelog vendored
View File

@@ -1,3 +1,37 @@
mesa (7.7-3) experimental; urgency=low
* Pull from upstream mesa_7_7_branch up to commit f5145a6e.
* Build against libdrm-radeon1 2.4.17 to get DRI2 support.
-- Brice Goglin <bgoglin@debian.org> Mon, 01 Feb 2010 22:55:36 +0100
mesa (7.7-2) experimental; urgency=low
[ Julien Cristau ]
* Rename the build directory to not include DEB_BUILD_GNU_TYPE for no
good reason. Thanks, Colin Watson!
* Remove myself from Uploaders
[ Brice Goglin ]
* Pull from upstream mesa_7_7_branch up to commit 2f28ca0a.
+ Fix funky colors on radeon/r200/r300.
-- Brice Goglin <bgoglin@debian.org> Wed, 27 Jan 2010 09:14:38 +0100
mesa (7.7-1) experimental; urgency=low
[ Brice Goglin ]
* Bump libdrm build dependency to 2.4.15, closes: #561058.
* New upstream release.
* Pull from upstream mesa_7_7_branch up to commit 6d6c9c66.
[ Julien Cristau ]
* Add freedesktop.org ftp to watch file since that's where newer upstream
tarballs are.
* Don't include GLUT sources since we don't use them.
-- Brice Goglin <bgoglin@debian.org> Mon, 11 Jan 2010 17:52:31 +0100
mesa (7.7~rc2-1) experimental; urgency=low
* New upstream release candidate.
@@ -5,6 +39,17 @@ mesa (7.7~rc2-1) experimental; urgency=low
-- Brice Goglin <bgoglin@debian.org> Sat, 12 Dec 2009 13:02:55 +0100
mesa (7.6.1-1) unstable; urgency=low
* New upstream release
+ Pull upstream mesa_7_6_branch up to commit da876fa3
* Bump linux-libc-dev build-dep to 2.6.31 for the r600 dri driver (fixes
ftbfs on mips).
* Drop hunk from 05_hurd-ftbfs.diff that was applied upstream. Refresh
other patches.
-- Julien Cristau <jcristau@debian.org> Tue, 29 Dec 2009 10:42:24 +0000
mesa (7.6.1~rc3-1) unstable; urgency=low
* New upstream release candidate.

6
debian/control vendored
View File

@@ -2,14 +2,14 @@ Source: mesa
Section: graphics
Priority: optional
Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
Uploaders: Thierry Reding <thierry@gilfi.de>, Julien Cristau <jcristau@debian.org>, David Nusinow <dnusinow@debian.org>, Brice Goglin <bgoglin@debian.org>
Uploaders: Thierry Reding <thierry@gilfi.de>, David Nusinow <dnusinow@debian.org>, Brice Goglin <bgoglin@debian.org>
Standards-Version: 3.8.3
Build-Depends: debhelper (>= 6.0.7), quilt (>= 0.40), pkg-config,
libdrm-dev (>= 2.4.3) [!hurd-i386], libx11-dev, xutils-dev,
libdrm-dev (>= 2.4.15) [!hurd-i386], libx11-dev, xutils-dev,
x11proto-gl-dev (>= 1.4.8), libxxf86vm-dev,
libexpat1-dev, lesstif2-dev, dpkg-dev (>= 1.13.19), libxfixes-dev,
libxdamage-dev, libxext-dev, autoconf, automake, x11proto-dri2-dev (>= 1.99.3),
linux-libc-dev (>= 2.6.29) [!hurd-i386 !kfreebsd-amd64 !kfreebsd-i386]
linux-libc-dev (>= 2.6.31) [!hurd-i386 !kfreebsd-amd64 !kfreebsd-i386]
Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/mesa
Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/mesa.git
Homepage: http://mesa3d.sourceforge.net/

View File

@@ -6,7 +6,7 @@ Index: mesa/src/mesa/main/compiler.h
===================================================================
--- mesa.orig/src/mesa/main/compiler.h
+++ mesa/src/mesa/main/compiler.h
@@ -347,8 +347,9 @@
@@ -351,8 +351,9 @@
* USE_IEEE: Determine if we're using IEEE floating point
*/
#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \

View File

@@ -52,4 +52,4 @@ Index: mesa/progs/Makefile
+ done
clean:
-@for dir in $(SUBDIRS) tests ; do \
@list='$(SUBDIRS)'; for dir in $$list tests ; do \

View File

@@ -6,28 +6,11 @@ Subject: Fix build on GNU/Hurd
src/glx/x11/dri2.c | 2 ++
2 files changed, 16 insertions(+), 11 deletions(-)
Index: mesa-7.6.1~rc2/src/glx/x11/dri2.c
Index: mesa/configure.ac
===================================================================
--- mesa-7.6.1~rc2.orig/src/glx/x11/dri2.c 2009-12-05 23:51:01.000000000 +0100
+++ mesa-7.6.1~rc2/src/glx/x11/dri2.c 2009-12-06 00:10:10.000000000 +0100
@@ -30,6 +30,7 @@
* Kristian Høgsberg (krh@redhat.com)
*/
+#ifdef GLX_DIRECT_RENDERING
#define NEED_REPLIES
#include <X11/Xlibint.h>
@@ -377,3 +378,4 @@
UnlockDisplay(dpy);
SyncHandle();
}
+#endif
Index: mesa-7.6.1~rc2/configure.ac
===================================================================
--- mesa-7.6.1~rc2.orig/configure.ac 2009-12-05 23:50:57.000000000 +0100
+++ mesa-7.6.1~rc2/configure.ac 2009-12-06 00:10:27.000000000 +0100
@@ -538,6 +538,13 @@
--- mesa.orig/configure.ac
+++ mesa/configure.ac
@@ -539,6 +539,13 @@
enable_xcb=no
fi
@@ -41,7 +24,7 @@ Index: mesa-7.6.1~rc2/configure.ac
dnl
dnl libGL configuration per driver
dnl
@@ -571,11 +578,13 @@
@@ -572,11 +579,13 @@
AC_MSG_ERROR([Can't use static libraries for DRI drivers])
fi
@@ -58,9 +41,9 @@ Index: mesa-7.6.1~rc2/configure.ac
+ DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
+ fi
PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
@@ -656,12 +665,6 @@
@@ -657,12 +666,6 @@
[DRI_DRIVER_SEARCH_DIR="$withval"],
[DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
AC_SUBST([DRI_DRIVER_SEARCH_DIR])

View File

@@ -8,11 +8,11 @@ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524690
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mesa-7.6.1~rc2/configure.ac
Index: mesa/configure.ac
===================================================================
--- mesa-7.6.1~rc2.orig/configure.ac 2009-12-06 00:10:10.000000000 +0100
+++ mesa-7.6.1~rc2/configure.ac 2009-12-06 00:10:10.000000000 +0100
@@ -745,7 +745,7 @@
--- mesa.orig/configure.ac
+++ mesa/configure.ac
@@ -746,7 +746,7 @@
;;
esac
;;

4
debian/rules vendored
View File

@@ -22,7 +22,7 @@ DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_BUILD_DIR ?= $(CURDIR)/obj-$(DEB_BUILD_GNU_TYPE)
DEB_BUILD_DIR ?= $(CURDIR)/build
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
confflags += --build=$(DEB_HOST_GNU_TYPE)
else
@@ -207,7 +207,7 @@ clean: unpatch
rm -f */config.cache */config.log */config.status
rm -f conftest* */conftest*
rm -rf autom4te.cache */autom4te.cache
rm -rf obj-*
rm -rf build
rm -rf configure config.guess config.sub config.h.in
rm -rf $$(find -name Makefile.in)
rm -rf aclocal.m4 missing depcomp install-sh ltmain.sh

3
debian/watch vendored
View File

@@ -1,3 +1,6 @@
version=3
opts="uversionmangle=s/-rc/~rc/" \
http://sf.net/mesa3d/MesaLib-(.*)\.tar\.gz
opts="uversionmangle=s/-rc/~rc/" \
ftp://freedesktop.org/pub/mesa/([\d\.]*)/ MesaLib-(.*)\.tar\.gz

View File

@@ -51,5 +51,24 @@ See the <A HREF="xlibdriver.html">Xlib software driver page</A> for details.
</ul>
<p>
These environment variables are for the Intel i945/i965 drivers:
</p>
<ul>
<li>INTEL_STRICT_CONFORMANCE - if set to 1, enable sw fallbacks to improve
OpenGL conformance. If set to 2, always use software rendering.
<li>INTEL_NO_BLIT - if set, disable hardware-accelerated glBitmap,
glCopyPixels, glDrawPixels.
</ul>
<p>
These environment variables are for the Radeon R300 driver:
</p>
<ul>
<li>R300_NO_TCL - if set, disable hardware-accelerated Transform/Clip/Lighting.
</ul>
</BODY>
</HTML>

View File

@@ -13,36 +13,41 @@
</p>
<ul>
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-announce"
target="_parent">mesa3d-announce</a> - announcements of new Mesa
versions are sent to this list.
</li>
<br>
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-users"
target="_parent">mesa3d-users</a> - intended for users of the Mesa and DRI.
Newbie questions are appropriate, but please try the general OpenGL
target="_parent">mesa3d-users</a> - intended for end-users of Mesa and DRI
drivers. Newbie questions are OK, but please try the general OpenGL
resources and Mesa/DRI documentation first.
</li>
<br>
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-dev"
target="_parent">mesa3d-dev</a> - for discussion of Mesa and Direct Rendering
Infrastructure development. Not for beginners.
target="_parent">mesa3d-dev</a> - for Mesa, Gallium and DRI development
discussion. Not for beginners.
</li>
<br>
<li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-commit"
target="_parent">mesa-commit</a> - relays git check-in messages
(for developers).
In general, people should not post to this list.
</li>
<br>
Note: the old mesa3d-cvs list is no longer in use.
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-announce"
target="_parent">mesa3d-announce</a> - announcements of new Mesa
versions are sent to this list. Very low traffic.
</li>
</ul>
<p>
Follow the links above for list archives.
</p>
<p>For mailing lists about Direct Rendering Modules (drm) in Linux/BSD
kernels, see <a href="http://dri.freedesktop.org/wiki/MailingLists">wiki</a>.
kernels, see the
<a href="http://dri.freedesktop.org/wiki/MailingLists" target="_parent">
DRI wiki</a>.
</p>
<p>
<b>Notice</b>: non-member posts to any of these lists will be automatically
rejected.
<b>Notice</b>: You must subscribe to these lists in order to post to them.
</p>

View File

@@ -10,11 +10,15 @@
<H1>News</H1>
<h2>November XX, 2009</h2>
<h2>December 21, 2009</h2>
<p>
<a href="relnotes-7.6.1.html">Mesa 7.6.1</a> is released. This is a bug-fix
release fixing issues found in the 7.6 release.
</p>
<p>
Also, <a href="relnotes-7.7.html">Mesa 7.7</a> is released. This is a new
development release.
</p>
<h2>September 28, 2009</h2>

View File

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.6.1 Release Notes, (date tbd)</H1>
<H1>Mesa 7.6.1 Release Notes, 21 December 2009</H1>
<p>
Mesa 7.6.1 is a bug-fix release fixing issues since version 7.6.
@@ -26,7 +26,15 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
e80fabad2e3eb7990adae773d6aeacba MesaLib-7.6.1.tar.gz
7db4617e9e10ad3aca1b64339fd71b7d MesaLib-7.6.1.tar.bz2
dd3275dbf9833480d2e92d0c69b22abd MesaLib-7.6.1.zip
f7fdcfe3c0f363e571c60f02f74368fb MesaDemos-7.6.1.tar.gz
a4226f06732a02556fcf6be290b86dff MesaDemos-7.6.1.tar.bz2
849425f356bd940726cebedfa79de176 MesaDemos-7.6.1.zip
d40cc7c5e337a85b674e27a8e494f52f MesaGLUT-7.6.1.tar.gz
ca9aecb91f05b1da9fd7d5eeb19d47d7 MesaGLUT-7.6.1.tar.bz2
23fad8398004c977a1d8953079b72ca6 MesaGLUT-7.6.1.zip
</pre>
@@ -59,6 +67,7 @@ tbd
<li>Point sprite fixes for i915/945 driver.
<li>Fixed assorted memory leaks (usually on error paths)
<li>Fixed some GLSL compiler bugs (ex: 25579)
<li>Assorted build fixes for BlueGene
</ul>
<h2>Changes</h2>

51
docs/relnotes-7.7.1.html Normal file
View File

@@ -0,0 +1,51 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.7.1 Release Notes / date tbd</H1>
<p>
Mesa 7.7.1 is a bug-fix release.
</p>
<p>
Mesa 7.7.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>tbd
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Assorted fixes to VMware SVGA gallium driver.
<li>Fixed broken blending to multiple color buffers in swrast driver.
<li>Allocate constants more tightly in GL_ARB_vertex/fragment parser.
<li>Fixed mipmap generation bug caused by invalid viewport state.
<li>Gallium SSE codegen for XPD didn't always work.
<li>Fixed Windows build.
</ul>
</body>
</html>

View File

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.7 Release Notes / date TBD</H1>
<H1>Mesa 7.7 Release Notes / 21 December 2009</H1>
<p>
Mesa 7.7 is a new development release.
@@ -28,7 +28,15 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
395c9516edf1ad54b0934d8db15557bf MesaLib-7.7.tar.gz
e3fa64a1508bc23dd9de9dd2cea7cfb1 MesaLib-7.7.tar.bz2
e54903eb5e49c3969821fa16b32da245 MesaLib-7.7.zip
53b5b6f78e55de170d43c98cb6aaab7e MesaDemos-7.7.tar.gz
6fd616b27b9826d0faa23e08e05d9435 MesaDemos-7.7.tar.bz2
240fe06159ad73d5e22c27033b66c80a MesaDemos-7.7.zip
9fe11a904b2a9d8cd06cc52bc330b716 MesaGLUT-7.7.tar.gz
e8dceed05a59a2d3c2619d7d734587e3 MesaGLUT-7.7.tar.bz2
96af041d435349ee23ead4667ec36363 MesaGLUT-7.7.zip
</pre>

View File

@@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-7.7.1.html">7.7.1 release notes</A>
<LI><A HREF="relnotes-7.7.html">7.7 release notes</A>
<LI><A HREF="relnotes-7.6.1.html">7.6.1 release notes</A>
<LI><A HREF="relnotes-7.6.html">7.6 release notes</A>

View File

@@ -30,6 +30,7 @@
/*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */
#define glAccum MANGLE(Accum)
#define glActiveProgramEXT MANGLE(ActiveProgramEXT)
#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT)
#define glActiveTextureARB MANGLE(ActiveTextureARB)
#define glActiveTexture MANGLE(ActiveTexture)
@@ -60,6 +61,7 @@
#define glBeginTransformFeedback MANGLE(BeginTransformFeedback)
#define glBeginTransformFeedbackNV MANGLE(BeginTransformFeedbackNV)
#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT)
#define glBeginVideoCaptureNV MANGLE(BeginVideoCaptureNV)
#define glBindAttribLocationARB MANGLE(BindAttribLocationARB)
#define glBindAttribLocation MANGLE(BindAttribLocation)
#define glBindBufferARB MANGLE(BindBufferARB)
@@ -93,6 +95,8 @@
#define glBindVertexArrayAPPLE MANGLE(BindVertexArrayAPPLE)
#define glBindVertexArray MANGLE(BindVertexArray)
#define glBindVertexShaderEXT MANGLE(BindVertexShaderEXT)
#define glBindVideoCaptureStreamBufferNV MANGLE(BindVideoCaptureStreamBufferNV)
#define glBindVideoCaptureStreamTextureNV MANGLE(BindVideoCaptureStreamTextureNV)
#define glBinormal3bEXT MANGLE(Binormal3bEXT)
#define glBinormal3bvEXT MANGLE(Binormal3bvEXT)
#define glBinormal3dEXT MANGLE(Binormal3dEXT)
@@ -126,6 +130,7 @@
#define glBlendFuncSeparate MANGLE(BlendFuncSeparate)
#define glBlitFramebufferEXT MANGLE(BlitFramebufferEXT)
#define glBlitFramebuffer MANGLE(BlitFramebuffer)
#define glBufferAddressRangeNV MANGLE(BufferAddressRangeNV)
#define glBufferDataARB MANGLE(BufferDataARB)
#define glBufferData MANGLE(BufferData)
#define glBufferParameteriAPPLE MANGLE(BufferParameteriAPPLE)
@@ -202,6 +207,7 @@
#define glColor4uiv MANGLE(Color4uiv)
#define glColor4us MANGLE(Color4us)
#define glColor4usv MANGLE(Color4usv)
#define glColorFormatNV MANGLE(ColorFormatNV)
#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI)
#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI)
#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI)
@@ -276,6 +282,7 @@
#define glCopyConvolutionFilter1D MANGLE(CopyConvolutionFilter1D)
#define glCopyConvolutionFilter2DEXT MANGLE(CopyConvolutionFilter2DEXT)
#define glCopyConvolutionFilter2D MANGLE(CopyConvolutionFilter2D)
#define glCopyImageSubDataNV MANGLE(CopyImageSubDataNV)
#define glCopyMultiTexImage1DEXT MANGLE(CopyMultiTexImage1DEXT)
#define glCopyMultiTexImage2DEXT MANGLE(CopyMultiTexImage2DEXT)
#define glCopyMultiTexSubImage1DEXT MANGLE(CopyMultiTexSubImage1DEXT)
@@ -302,6 +309,7 @@
#define glCreateProgramObjectARB MANGLE(CreateProgramObjectARB)
#define glCreateShader MANGLE(CreateShader)
#define glCreateShaderObjectARB MANGLE(CreateShaderObjectARB)
#define glCreateShaderProgramEXT MANGLE(CreateShaderProgramEXT)
#define glCullFace MANGLE(CullFace)
#define glCullParameterdvEXT MANGLE(CullParameterdvEXT)
#define glCullParameterfvEXT MANGLE(CullParameterfvEXT)
@@ -379,6 +387,7 @@
#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT)
#define glDrawRangeElements MANGLE(DrawRangeElements)
#define glDrawTransformFeedbackNV MANGLE(DrawTransformFeedbackNV)
#define glEdgeFlagFormatNV MANGLE(EdgeFlagFormatNV)
#define glEdgeFlag MANGLE(EdgeFlag)
#define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT)
#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM)
@@ -408,6 +417,7 @@
#define glEndTransformFeedback MANGLE(EndTransformFeedback)
#define glEndTransformFeedbackNV MANGLE(EndTransformFeedbackNV)
#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT)
#define glEndVideoCaptureNV MANGLE(EndVideoCaptureNV)
#define glEvalCoord1d MANGLE(EvalCoord1d)
#define glEvalCoord1dv MANGLE(EvalCoord1dv)
#define glEvalCoord1f MANGLE(EvalCoord1f)
@@ -445,6 +455,7 @@
#define glFogCoorddv MANGLE(FogCoorddv)
#define glFogCoordfEXT MANGLE(FogCoordfEXT)
#define glFogCoordf MANGLE(FogCoordf)
#define glFogCoordFormatNV MANGLE(FogCoordFormatNV)
#define glFogCoordfvEXT MANGLE(FogCoordfvEXT)
#define glFogCoordfv MANGLE(FogCoordfv)
#define glFogCoordhNV MANGLE(FogCoordhNV)
@@ -544,6 +555,7 @@
#define glGetBufferParameteri64v MANGLE(GetBufferParameteri64v)
#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB)
#define glGetBufferParameteriv MANGLE(GetBufferParameteriv)
#define glGetBufferParameterui64vNV MANGLE(GetBufferParameterui64vNV)
#define glGetBufferPointervARB MANGLE(GetBufferPointervARB)
#define glGetBufferPointerv MANGLE(GetBufferPointerv)
#define glGetBufferSubDataARB MANGLE(GetBufferSubDataARB)
@@ -609,6 +621,8 @@
#define glGetInteger64v MANGLE(GetInteger64v)
#define glGetIntegerIndexedvEXT MANGLE(GetIntegerIndexedvEXT)
#define glGetIntegeri_v MANGLE(GetIntegeri_v)
#define glGetIntegerui64i_vNV MANGLE(GetIntegerui64i_vNV)
#define glGetIntegerui64vNV MANGLE(GetIntegerui64vNV)
#define glGetIntegerv MANGLE(GetIntegerv)
#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT)
#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT)
@@ -651,6 +665,7 @@
#define glGetMultiTexParameterIuivEXT MANGLE(GetMultiTexParameterIuivEXT)
#define glGetMultiTexParameterivEXT MANGLE(GetMultiTexParameterivEXT)
#define glGetNamedBufferParameterivEXT MANGLE(GetNamedBufferParameterivEXT)
#define glGetNamedBufferParameterui64vNV MANGLE(GetNamedBufferParameterui64vNV)
#define glGetNamedBufferPointervEXT MANGLE(GetNamedBufferPointervEXT)
#define glGetNamedBufferSubDataEXT MANGLE(GetNamedBufferSubDataEXT)
#define glGetNamedFramebufferAttachmentParameterivEXT MANGLE(GetNamedFramebufferAttachmentParameterivEXT)
@@ -761,6 +776,7 @@
#define glGetUniformLocationARB MANGLE(GetUniformLocationARB)
#define glGetUniformLocation MANGLE(GetUniformLocation)
#define glGetUniformOffsetEXT MANGLE(GetUniformOffsetEXT)
#define glGetUniformui64vNV MANGLE(GetUniformui64vNV)
#define glGetUniformuivEXT MANGLE(GetUniformuivEXT)
#define glGetUniformuiv MANGLE(GetUniformuiv)
#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI)
@@ -788,6 +804,10 @@
#define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB)
#define glGetVertexAttribPointerv MANGLE(GetVertexAttribPointerv)
#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV)
#define glGetVideoCaptureivNV MANGLE(GetVideoCaptureivNV)
#define glGetVideoCaptureStreamdvNV MANGLE(GetVideoCaptureStreamdvNV)
#define glGetVideoCaptureStreamfvNV MANGLE(GetVideoCaptureStreamfvNV)
#define glGetVideoCaptureStreamivNV MANGLE(GetVideoCaptureStreamivNV)
#define glGetVideoi64vNV MANGLE(GetVideoi64vNV)
#define glGetVideoivNV MANGLE(GetVideoivNV)
#define glGetVideoui64vNV MANGLE(GetVideoui64vNV)
@@ -812,6 +832,7 @@
#define glIndexd MANGLE(Indexd)
#define glIndexdv MANGLE(Indexdv)
#define glIndexf MANGLE(Indexf)
#define glIndexFormatNV MANGLE(IndexFormatNV)
#define glIndexFuncEXT MANGLE(IndexFuncEXT)
#define glIndexfv MANGLE(Indexfv)
#define glIndexi MANGLE(Indexi)
@@ -832,6 +853,7 @@
#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX)
#define glIsBufferARB MANGLE(IsBufferARB)
#define glIsBuffer MANGLE(IsBuffer)
#define glIsBufferResidentNV MANGLE(IsBufferResidentNV)
#define glIsEnabledi MANGLE(IsEnabledi)
#define glIsEnabledIndexedEXT MANGLE(IsEnabledIndexedEXT)
#define glIsEnabled MANGLE(IsEnabled)
@@ -840,6 +862,7 @@
#define glIsFramebufferEXT MANGLE(IsFramebufferEXT)
#define glIsFramebuffer MANGLE(IsFramebuffer)
#define glIsList MANGLE(IsList)
#define glIsNamedBufferResidentNV MANGLE(IsNamedBufferResidentNV)
#define glIsObjectBufferATI MANGLE(IsObjectBufferATI)
#define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV)
#define glIsProgramARB MANGLE(IsProgramARB)
@@ -888,6 +911,8 @@
#define glLoadTransposeMatrixf MANGLE(LoadTransposeMatrixf)
#define glLockArraysEXT MANGLE(LockArraysEXT)
#define glLogicOp MANGLE(LogicOp)
#define glMakeBufferNonResidentNV MANGLE(MakeBufferNonResidentNV)
#define glMakeBufferResidentNV MANGLE(MakeBufferResidentNV)
#define glMap1d MANGLE(Map1d)
#define glMap1f MANGLE(Map1f)
#define glMap2d MANGLE(Map2d)
@@ -1060,6 +1085,8 @@
#define glNamedFramebufferTextureEXT MANGLE(NamedFramebufferTextureEXT)
#define glNamedFramebufferTextureFaceEXT MANGLE(NamedFramebufferTextureFaceEXT)
#define glNamedFramebufferTextureLayerEXT MANGLE(NamedFramebufferTextureLayerEXT)
#define glNamedMakeBufferNonResidentNV MANGLE(NamedMakeBufferNonResidentNV)
#define glNamedMakeBufferResidentNV MANGLE(NamedMakeBufferResidentNV)
#define glNamedProgramLocalParameter4dEXT MANGLE(NamedProgramLocalParameter4dEXT)
#define glNamedProgramLocalParameter4dvEXT MANGLE(NamedProgramLocalParameter4dvEXT)
#define glNamedProgramLocalParameter4fEXT MANGLE(NamedProgramLocalParameter4fEXT)
@@ -1091,6 +1118,7 @@
#define glNormal3iv MANGLE(Normal3iv)
#define glNormal3s MANGLE(Normal3s)
#define glNormal3sv MANGLE(Normal3sv)
#define glNormalFormatNV MANGLE(NormalFormatNV)
#define glNormalPointerEXT MANGLE(NormalPointerEXT)
#define glNormalPointerListIBM MANGLE(NormalPointerListIBM)
#define glNormalPointer MANGLE(NormalPointer)
@@ -1234,6 +1262,8 @@
#define glProgramUniformMatrix4fvEXT MANGLE(ProgramUniformMatrix4fvEXT)
#define glProgramUniformMatrix4x2fvEXT MANGLE(ProgramUniformMatrix4x2fvEXT)
#define glProgramUniformMatrix4x3fvEXT MANGLE(ProgramUniformMatrix4x3fvEXT)
#define glProgramUniformui64NV MANGLE(ProgramUniformui64NV)
#define glProgramUniformui64vNV MANGLE(ProgramUniformui64vNV)
#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV)
#define glProvokingVertexEXT MANGLE(ProvokingVertexEXT)
#define glProvokingVertex MANGLE(ProvokingVertex)
@@ -1362,6 +1392,7 @@
#define glSecondaryColor3us MANGLE(SecondaryColor3us)
#define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT)
#define glSecondaryColor3usv MANGLE(SecondaryColor3usv)
#define glSecondaryColorFormatNV MANGLE(SecondaryColorFormatNV)
#define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT)
#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM)
#define glSecondaryColorPointer MANGLE(SecondaryColorPointer)
@@ -1475,6 +1506,7 @@
#define glTexCoord4iv MANGLE(TexCoord4iv)
#define glTexCoord4s MANGLE(TexCoord4s)
#define glTexCoord4sv MANGLE(TexCoord4sv)
#define glTexCoordFormatNV MANGLE(TexCoordFormatNV)
#define glTexCoordPointerEXT MANGLE(TexCoordPointerEXT)
#define glTexCoordPointerListIBM MANGLE(TexCoordPointerListIBM)
#define glTexCoordPointer MANGLE(TexCoordPointer)
@@ -1513,6 +1545,7 @@
#define glTexSubImage3DEXT MANGLE(TexSubImage3DEXT)
#define glTexSubImage3D MANGLE(TexSubImage3D)
#define glTexSubImage4DSGIS MANGLE(TexSubImage4DSGIS)
#define glTextureBarrierNV MANGLE(TextureBarrierNV)
#define glTextureBufferEXT MANGLE(TextureBufferEXT)
#define glTextureColorMaskSGIS MANGLE(TextureColorMaskSGIS)
#define glTextureImage1DEXT MANGLE(TextureImage1DEXT)
@@ -1601,6 +1634,8 @@
#define glUniformMatrix4fv MANGLE(UniformMatrix4fv)
#define glUniformMatrix4x2fv MANGLE(UniformMatrix4x2fv)
#define glUniformMatrix4x3fv MANGLE(UniformMatrix4x3fv)
#define glUniformui64NV MANGLE(Uniformui64NV)
#define glUniformui64vNV MANGLE(Uniformui64vNV)
#define glUnlockArraysEXT MANGLE(UnlockArraysEXT)
#define glUnmapBufferARB MANGLE(UnmapBufferARB)
#define glUnmapBuffer MANGLE(UnmapBuffer)
@@ -1609,6 +1644,7 @@
#define glUpdateObjectBufferATI MANGLE(UpdateObjectBufferATI)
#define glUseProgram MANGLE(UseProgram)
#define glUseProgramObjectARB MANGLE(UseProgramObjectARB)
#define glUseShaderProgramEXT MANGLE(UseShaderProgramEXT)
#define glValidateProgramARB MANGLE(ValidateProgramARB)
#define glValidateProgram MANGLE(ValidateProgram)
#define glVariantArrayObjectATI MANGLE(VariantArrayObjectATI)
@@ -1762,6 +1798,7 @@
#define glVertexAttrib4usv MANGLE(VertexAttrib4usv)
#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI)
#define glVertexAttribDivisorARB MANGLE(VertexAttribDivisorARB)
#define glVertexAttribFormatNV MANGLE(VertexAttribFormatNV)
#define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT)
#define glVertexAttribI1i MANGLE(VertexAttribI1i)
#define glVertexAttribI1ivEXT MANGLE(VertexAttribI1ivEXT)
@@ -1802,6 +1839,7 @@
#define glVertexAttribI4uiv MANGLE(VertexAttribI4uiv)
#define glVertexAttribI4usvEXT MANGLE(VertexAttribI4usvEXT)
#define glVertexAttribI4usv MANGLE(VertexAttribI4usv)
#define glVertexAttribIFormatNV MANGLE(VertexAttribIFormatNV)
#define glVertexAttribIPointerEXT MANGLE(VertexAttribIPointerEXT)
#define glVertexAttribIPointer MANGLE(VertexAttribIPointer)
#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB)
@@ -1827,6 +1865,7 @@
#define glVertexBlendARB MANGLE(VertexBlendARB)
#define glVertexBlendEnvfATI MANGLE(VertexBlendEnvfATI)
#define glVertexBlendEnviATI MANGLE(VertexBlendEnviATI)
#define glVertexFormatNV MANGLE(VertexFormatNV)
#define glVertexPointerEXT MANGLE(VertexPointerEXT)
#define glVertexPointerListIBM MANGLE(VertexPointerListIBM)
#define glVertexPointer MANGLE(VertexPointer)
@@ -1868,6 +1907,10 @@
#define glVertexWeighthNV MANGLE(VertexWeighthNV)
#define glVertexWeighthvNV MANGLE(VertexWeighthvNV)
#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT)
#define glVideoCaptureNV MANGLE(VideoCaptureNV)
#define glVideoCaptureStreamParameterdvNV MANGLE(VideoCaptureStreamParameterdvNV)
#define glVideoCaptureStreamParameterfvNV MANGLE(VideoCaptureStreamParameterfvNV)
#define glVideoCaptureStreamParameterivNV MANGLE(VideoCaptureStreamParameterivNV)
#define glViewport MANGLE(Viewport)
#define glWaitSync MANGLE(WaitSync)
#define glWeightbvARB MANGLE(WeightbvARB)

View File

@@ -1,668 +0,0 @@
#ifndef __glut_h__
#define __glut_h__
/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
/* This program is freely distributable without licensing fees and is
provided without guarantee or warrantee expressed or implied. This
program is -not- in the public domain. */
#if defined(_WIN32)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# endif
# include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glu.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32)
/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
in your compile preprocessor options. */
# if defined(_MSC_VER) && !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
/* To enable automatic SGI OpenGL for Windows library usage for GLUT,
define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */
# ifdef GLUT_USE_SGI_OPENGL
# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */
# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */
# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */
# else
# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */
# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
# endif
# endif
/* To disable supression of annoying warnings about floats being promoted
to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
options. */
# if defined(_MSC_VER) && !defined(GLUT_NO_WARNING_DISABLE)
# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */
# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
# endif
/* Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
/* XXX This is from Win32's <process.h> */
# if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__cdecl)
/* Define __cdecl for non-Microsoft compilers. */
# define __cdecl
# define GLUT_DEFINED___CDECL
# endif
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
#include <stdlib.h>
#endif
/* GLUT callback calling convention for Win32. */
# define GLUTCALLBACK __cdecl
/* for callback/function pointer defs */
# define GLUTAPIENTRYV __cdecl
/* glut-win32 specific macros, defined to prevent collision with
and redifinition of Windows system defs, also removes requirement of
pretty much any standard windows header from this file */
#if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
# define GLUTAPIENTRY __stdcall
#else
# define GLUTAPIENTRY
#endif
/* GLUT API entry point declarations for Win32. */
#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && !defined(GLUT_STATIC)
# define GLUTAPI __declspec(dllexport)
#elif !defined(GLUT_STATIC)
# define GLUTAPI __declspec(dllimport)
#else
# define GLUTAPI extern
#endif
#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
# define GLUTAPIENTRY
# define GLUTAPIENTRYV
# define GLUTCALLBACK
# define GLUTAPI extern __attribute__((visibility("default")))
#else
/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing */
# define GLUTAPIENTRY
# define GLUTAPIENTRYV
# define GLUTCALLBACK
# define GLUTAPI extern
#endif
/**
GLUT API revision history:
GLUT_API_VERSION is updated to reflect incompatible GLUT
API changes (interface changes, semantic changes, deletions,
or additions).
GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
extension. Supports new input devices like tablet, dial and button
box, and Spaceball. Easy to query OpenGL extensions.
GLUT_API_VERSION=3 glutMenuStatus added.
GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).
GLUT_API_VERSION=5 glutGetProcAddress (added by BrianP)
**/
#ifndef GLUT_API_VERSION /* allow this to be overriden */
#define GLUT_API_VERSION 5
#endif
/**
GLUT implementation revision history:
GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
API revisions and implementation revisions (ie, bug fixes).
GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
GLUT Xlib-based implementation. 11/29/94
GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
GLUT Xlib-based implementation providing GLUT version 2
interfaces.
GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
and video resize. 1/3/97
GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
**/
#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
#define GLUT_XLIB_IMPLEMENTATION 15
#endif
/* Display mode bit masks. */
#define GLUT_RGB 0
#define GLUT_RGBA GLUT_RGB
#define GLUT_INDEX 1
#define GLUT_SINGLE 0
#define GLUT_DOUBLE 2
#define GLUT_ACCUM 4
#define GLUT_ALPHA 8
#define GLUT_DEPTH 16
#define GLUT_STENCIL 32
#if (GLUT_API_VERSION >= 2)
#define GLUT_MULTISAMPLE 128
#define GLUT_STEREO 256
#endif
#if (GLUT_API_VERSION >= 3)
#define GLUT_LUMINANCE 512
#endif
/* Mouse buttons. */
#define GLUT_LEFT_BUTTON 0
#define GLUT_MIDDLE_BUTTON 1
#define GLUT_RIGHT_BUTTON 2
/* Mouse button state. */
#define GLUT_DOWN 0
#define GLUT_UP 1
#if (GLUT_API_VERSION >= 2)
/* function keys */
#define GLUT_KEY_F1 1
#define GLUT_KEY_F2 2
#define GLUT_KEY_F3 3
#define GLUT_KEY_F4 4
#define GLUT_KEY_F5 5
#define GLUT_KEY_F6 6
#define GLUT_KEY_F7 7
#define GLUT_KEY_F8 8
#define GLUT_KEY_F9 9
#define GLUT_KEY_F10 10
#define GLUT_KEY_F11 11
#define GLUT_KEY_F12 12
/* directional keys */
#define GLUT_KEY_LEFT 100
#define GLUT_KEY_UP 101
#define GLUT_KEY_RIGHT 102
#define GLUT_KEY_DOWN 103
#define GLUT_KEY_PAGE_UP 104
#define GLUT_KEY_PAGE_DOWN 105
#define GLUT_KEY_HOME 106
#define GLUT_KEY_END 107
#define GLUT_KEY_INSERT 108
#endif
/* Entry/exit state. */
#define GLUT_LEFT 0
#define GLUT_ENTERED 1
/* Menu usage state. */
#define GLUT_MENU_NOT_IN_USE 0
#define GLUT_MENU_IN_USE 1
/* Visibility state. */
#define GLUT_NOT_VISIBLE 0
#define GLUT_VISIBLE 1
/* Window status state. */
#define GLUT_HIDDEN 0
#define GLUT_FULLY_RETAINED 1
#define GLUT_PARTIALLY_RETAINED 2
#define GLUT_FULLY_COVERED 3
/* Color index component selection values. */
#define GLUT_RED 0
#define GLUT_GREEN 1
#define GLUT_BLUE 2
/* Layers for use. */
#define GLUT_NORMAL 0
#define GLUT_OVERLAY 1
#if defined(_WIN32) || defined (GLUT_IMPORT_LIB)
/* Stroke font constants (use these in GLUT program). */
#define GLUT_STROKE_ROMAN ((void*)0)
#define GLUT_STROKE_MONO_ROMAN ((void*)1)
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 ((void*)2)
#define GLUT_BITMAP_8_BY_13 ((void*)3)
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
#if (GLUT_API_VERSION >= 3)
#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
#endif
#else
/* Stroke font opaque addresses (use constants instead in source code). */
GLUTAPI void *glutStrokeRoman;
GLUTAPI void *glutStrokeMonoRoman;
/* Stroke font constants (use these in GLUT program). */
#define GLUT_STROKE_ROMAN (&glutStrokeRoman)
#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
/* Bitmap font opaque addresses (use constants instead in source code). */
GLUTAPI void *glutBitmap9By15;
GLUTAPI void *glutBitmap8By13;
GLUTAPI void *glutBitmapTimesRoman10;
GLUTAPI void *glutBitmapTimesRoman24;
GLUTAPI void *glutBitmapHelvetica10;
GLUTAPI void *glutBitmapHelvetica12;
GLUTAPI void *glutBitmapHelvetica18;
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
#if (GLUT_API_VERSION >= 3)
#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
#endif
#endif
/* glutGet parameters. */
#define GLUT_WINDOW_X 100
#define GLUT_WINDOW_Y 101
#define GLUT_WINDOW_WIDTH 102
#define GLUT_WINDOW_HEIGHT 103
#define GLUT_WINDOW_BUFFER_SIZE 104
#define GLUT_WINDOW_STENCIL_SIZE 105
#define GLUT_WINDOW_DEPTH_SIZE 106
#define GLUT_WINDOW_RED_SIZE 107
#define GLUT_WINDOW_GREEN_SIZE 108
#define GLUT_WINDOW_BLUE_SIZE 109
#define GLUT_WINDOW_ALPHA_SIZE 110
#define GLUT_WINDOW_ACCUM_RED_SIZE 111
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
#define GLUT_WINDOW_DOUBLEBUFFER 115
#define GLUT_WINDOW_RGBA 116
#define GLUT_WINDOW_PARENT 117
#define GLUT_WINDOW_NUM_CHILDREN 118
#define GLUT_WINDOW_COLORMAP_SIZE 119
#if (GLUT_API_VERSION >= 2)
#define GLUT_WINDOW_NUM_SAMPLES 120
#define GLUT_WINDOW_STEREO 121
#endif
#if (GLUT_API_VERSION >= 3)
#define GLUT_WINDOW_CURSOR 122
#endif
#define GLUT_SCREEN_WIDTH 200
#define GLUT_SCREEN_HEIGHT 201
#define GLUT_SCREEN_WIDTH_MM 202
#define GLUT_SCREEN_HEIGHT_MM 203
#define GLUT_MENU_NUM_ITEMS 300
#define GLUT_DISPLAY_MODE_POSSIBLE 400
#define GLUT_INIT_WINDOW_X 500
#define GLUT_INIT_WINDOW_Y 501
#define GLUT_INIT_WINDOW_WIDTH 502
#define GLUT_INIT_WINDOW_HEIGHT 503
#define GLUT_INIT_DISPLAY_MODE 504
#if (GLUT_API_VERSION >= 2)
#define GLUT_ELAPSED_TIME 700
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
#define GLUT_WINDOW_FORMAT_ID 123
#endif
#if (GLUT_API_VERSION >= 2)
/* glutDeviceGet parameters. */
#define GLUT_HAS_KEYBOARD 600
#define GLUT_HAS_MOUSE 601
#define GLUT_HAS_SPACEBALL 602
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
#define GLUT_HAS_TABLET 604
#define GLUT_NUM_MOUSE_BUTTONS 605
#define GLUT_NUM_SPACEBALL_BUTTONS 606
#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
#define GLUT_NUM_DIALS 608
#define GLUT_NUM_TABLET_BUTTONS 609
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
#define GLUT_DEVICE_KEY_REPEAT 611
#define GLUT_HAS_JOYSTICK 612
#define GLUT_OWNS_JOYSTICK 613
#define GLUT_JOYSTICK_BUTTONS 614
#define GLUT_JOYSTICK_AXES 615
#define GLUT_JOYSTICK_POLL_RATE 616
#endif
#if (GLUT_API_VERSION >= 3)
/* glutLayerGet parameters. */
#define GLUT_OVERLAY_POSSIBLE 800
#define GLUT_LAYER_IN_USE 801
#define GLUT_HAS_OVERLAY 802
#define GLUT_TRANSPARENT_INDEX 803
#define GLUT_NORMAL_DAMAGED 804
#define GLUT_OVERLAY_DAMAGED 805
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
/* glutVideoResizeGet parameters. */
#define GLUT_VIDEO_RESIZE_POSSIBLE 900
#define GLUT_VIDEO_RESIZE_IN_USE 901
#define GLUT_VIDEO_RESIZE_X_DELTA 902
#define GLUT_VIDEO_RESIZE_Y_DELTA 903
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
#define GLUT_VIDEO_RESIZE_X 906
#define GLUT_VIDEO_RESIZE_Y 907
#define GLUT_VIDEO_RESIZE_WIDTH 908
#define GLUT_VIDEO_RESIZE_HEIGHT 909
#endif
/* glutUseLayer parameters. */
#define GLUT_NORMAL 0
#define GLUT_OVERLAY 1
/* glutGetModifiers return mask. */
#define GLUT_ACTIVE_SHIFT 1
#define GLUT_ACTIVE_CTRL 2
#define GLUT_ACTIVE_ALT 4
/* glutSetCursor parameters. */
/* Basic arrows. */
#define GLUT_CURSOR_RIGHT_ARROW 0
#define GLUT_CURSOR_LEFT_ARROW 1
/* Symbolic cursor shapes. */
#define GLUT_CURSOR_INFO 2
#define GLUT_CURSOR_DESTROY 3
#define GLUT_CURSOR_HELP 4
#define GLUT_CURSOR_CYCLE 5
#define GLUT_CURSOR_SPRAY 6
#define GLUT_CURSOR_WAIT 7
#define GLUT_CURSOR_TEXT 8
#define GLUT_CURSOR_CROSSHAIR 9
/* Directional cursors. */
#define GLUT_CURSOR_UP_DOWN 10
#define GLUT_CURSOR_LEFT_RIGHT 11
/* Sizing cursors. */
#define GLUT_CURSOR_TOP_SIDE 12
#define GLUT_CURSOR_BOTTOM_SIDE 13
#define GLUT_CURSOR_LEFT_SIDE 14
#define GLUT_CURSOR_RIGHT_SIDE 15
#define GLUT_CURSOR_TOP_LEFT_CORNER 16
#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
/* Inherit from parent window. */
#define GLUT_CURSOR_INHERIT 100
/* Blank cursor. */
#define GLUT_CURSOR_NONE 101
/* Fullscreen crosshair (if available). */
#define GLUT_CURSOR_FULL_CROSSHAIR 102
#endif
/* GLUT initialization sub-API. */
GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
#endif
#endif
GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string);
#endif
GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
/* GLUT window sub-API. */
GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
#endif
#endif
GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win);
GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win);
#endif
GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void);
GLUTAPI int GLUTAPIENTRY glutGetWindow(void);
GLUTAPI void GLUTAPIENTRY glutSetWindow(int win);
GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title);
GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title);
GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y);
GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height);
GLUTAPI void GLUTAPIENTRY glutPopWindow(void);
GLUTAPI void GLUTAPIENTRY glutPushWindow(void);
GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void);
GLUTAPI void GLUTAPIENTRY glutShowWindow(void);
GLUTAPI void GLUTAPIENTRY glutHideWindow(void);
#if (GLUT_API_VERSION >= 3)
GLUTAPI void GLUTAPIENTRY glutFullScreen(void);
GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y);
#endif
/* GLUT overlay sub-API. */
GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void);
GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void);
GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer);
GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win);
#endif
GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
#endif
/* GLUT menu sub-API. */
GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
#endif
#endif
GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);
GLUTAPI int GLUTAPIENTRY glutGetMenu(void);
GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu);
GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value);
GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu);
GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item);
GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button);
GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button);
/* GLUT window callback sub-API. */
GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
#if (GLUT_API_VERSION >= 2)
GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
#if (GLUT_API_VERSION >= 3)
GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
#endif
#endif
#endif
/* GLUT color index sub-API. */
GLUTAPI void GLUTAPIENTRY glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue);
GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
/* GLUT state retrieval sub-API. */
GLUTAPI int GLUTAPIENTRY glutGet(GLenum type);
GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type);
#if (GLUT_API_VERSION >= 2)
/* GLUT extension support sub-API */
GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name);
#endif
#if (GLUT_API_VERSION >= 3)
GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
#endif
#if (GLUT_API_VERSION >= 5)
typedef void (*GLUTproc)();
GLUTAPI GLUTproc GLUTAPIENTRY glutGetProcAddress(const char *procName);
#endif
/* GLUT font sub-API */
GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character);
GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character);
GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character);
GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string);
GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string);
#endif
/* GLUT pre-built models sub-API */
GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
/* GLUT video resize sub-API. */
GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param);
GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void);
GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void);
GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height);
GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height);
/* GLUT debugging sub-API. */
GLUTAPI void GLUTAPIENTRY glutReportErrors(void);
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
/* GLUT device control sub-API. */
/* glutSetKeyRepeat modes. */
#define GLUT_KEY_REPEAT_OFF 0
#define GLUT_KEY_REPEAT_ON 1
#define GLUT_KEY_REPEAT_DEFAULT 2
/* Joystick button masks. */
#define GLUT_JOYSTICK_BUTTON_A 1
#define GLUT_JOYSTICK_BUTTON_B 2
#define GLUT_JOYSTICK_BUTTON_C 4
#define GLUT_JOYSTICK_BUTTON_D 8
GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void);
/* GLUT game mode sub-API. */
/* glutGameModeGet. */
#define GLUT_GAME_MODE_ACTIVE 0
#define GLUT_GAME_MODE_POSSIBLE 1
#define GLUT_GAME_MODE_WIDTH 2
#define GLUT_GAME_MODE_HEIGHT 3
#define GLUT_GAME_MODE_PIXEL_DEPTH 4
#define GLUT_GAME_MODE_REFRESH_RATE 5
#define GLUT_GAME_MODE_DISPLAY_CHANGED 6
GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string);
GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void);
GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void);
GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __glut_h__ */

View File

@@ -1,340 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* This header file is based on the REAL glut.h by Mark J. Kilgard.
*
* The DJGPP/ALLEGRO (DJA) GLUT implementation was written by
* Bernhard Tschirren (bernie-t@geocities.com) for the sole purpose
* of compiling all the sample programs (which use GLUT). Therefore,
* is NOT AT ALL a complete version of GLUT!
*/
#ifndef __AGLUT_H__
#define __AGLUT_H__
#include <GL/gl.h>
#include <GL/glu.h>
#define GLUTCALLBACK
#define APIENTRY
#define GLUTAPI extern
#define GLUT_RGB 0
#define GLUT_RGBA GLUT_RGB
#define GLUT_INDEX 1
#define GLUT_SINGLE 0
#define GLUT_DOUBLE 2
#define GLUT_ACCUM 4
#define GLUT_ALPHA 8
#define GLUT_DEPTH 16
#define GLUT_STENCIL 32
/* Mouse buttons. */
#define GLUT_LEFT_BUTTON 0
#define GLUT_MIDDLE_BUTTON 1
#define GLUT_RIGHT_BUTTON 2
/* Mouse button state. */
#define GLUT_DOWN 0
#define GLUT_UP 1
/* function keys */
#define GLUT_KEY_F1 1
#define GLUT_KEY_F2 2
#define GLUT_KEY_F3 3
#define GLUT_KEY_F4 4
#define GLUT_KEY_F5 5
#define GLUT_KEY_F6 6
#define GLUT_KEY_F7 7
#define GLUT_KEY_F8 8
#define GLUT_KEY_F9 9
#define GLUT_KEY_F10 10
#define GLUT_KEY_F11 11
#define GLUT_KEY_F12 12
/* directional keys */
#define GLUT_KEY_LEFT 100
#define GLUT_KEY_UP 101
#define GLUT_KEY_RIGHT 102
#define GLUT_KEY_DOWN 103
#define GLUT_KEY_PAGE_UP 104
#define GLUT_KEY_PAGE_DOWN 105
#define GLUT_KEY_HOME 106
#define GLUT_KEY_END 107
#define GLUT_KEY_INSERT 108
/* Entry/exit state. */
#define GLUT_LEFT 0
#define GLUT_ENTERED 1
/* Visibility state. */
#define GLUT_NOT_VISIBLE 0
#define GLUT_VISIBLE 1
/* Color index component selection values. */
#define GLUT_RED 0
#define GLUT_GREEN 1
#define GLUT_BLUE 2
/* Layers for use. */
#define GLUT_NORMAL 0
#define GLUT_OVERLAY 1
/* Stroke font constants (use these in GLUT program). */
#define GLUT_STROKE_ROMAN ((void*)0)
#define GLUT_STROKE_MONO_ROMAN ((void*)1)
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 ((void*)2)
#define GLUT_BITMAP_8_BY_13 ((void*)3)
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
/* glutGet parameters. */
#define GLUT_WINDOW_X 100
#define GLUT_WINDOW_Y 101
#define GLUT_WINDOW_WIDTH 102
#define GLUT_WINDOW_HEIGHT 103
#define GLUT_WINDOW_BUFFER_SIZE 104
#define GLUT_WINDOW_STENCIL_SIZE 105
#define GLUT_WINDOW_DEPTH_SIZE 106
#define GLUT_WINDOW_RED_SIZE 107
#define GLUT_WINDOW_GREEN_SIZE 108
#define GLUT_WINDOW_BLUE_SIZE 109
#define GLUT_WINDOW_ALPHA_SIZE 110
#define GLUT_WINDOW_ACCUM_RED_SIZE 111
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
#define GLUT_WINDOW_DOUBLEBUFFER 115
#define GLUT_WINDOW_RGBA 116
#define GLUT_WINDOW_PARENT 117
#define GLUT_WINDOW_NUM_CHILDREN 118
#define GLUT_WINDOW_COLORMAP_SIZE 119
#define GLUT_WINDOW_NUM_SAMPLES 120
#define GLUT_WINDOW_STEREO 121
#define GLUT_WINDOW_CURSOR 122
#define GLUT_SCREEN_WIDTH 200
#define GLUT_SCREEN_HEIGHT 201
#define GLUT_SCREEN_WIDTH_MM 202
#define GLUT_SCREEN_HEIGHT_MM 203
#define GLUT_MENU_NUM_ITEMS 300
#define GLUT_DISPLAY_MODE_POSSIBLE 400
#define GLUT_INIT_WINDOW_X 500
#define GLUT_INIT_WINDOW_Y 501
#define GLUT_INIT_WINDOW_WIDTH 502
#define GLUT_INIT_WINDOW_HEIGHT 503
#define GLUT_INIT_DISPLAY_MODE 504
#define GLUT_ELAPSED_TIME 700
#define GLUT_WINDOW_FORMAT_ID 123
/* glutDeviceGet parameters. */
#define GLUT_HAS_KEYBOARD 600
#define GLUT_HAS_MOUSE 601
#define GLUT_HAS_SPACEBALL 602
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
#define GLUT_HAS_TABLET 604
#define GLUT_NUM_MOUSE_BUTTONS 605
#define GLUT_NUM_SPACEBALL_BUTTONS 606
#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
#define GLUT_NUM_DIALS 608
#define GLUT_NUM_TABLET_BUTTONS 609
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
#define GLUT_DEVICE_KEY_REPEAT 611
#define GLUT_HAS_JOYSTICK 612
#define GLUT_OWNS_JOYSTICK 613
#define GLUT_JOYSTICK_BUTTONS 614
#define GLUT_JOYSTICK_AXES 615
#define GLUT_JOYSTICK_POLL_RATE 616
/* glutLayerGet parameters. */
#define GLUT_OVERLAY_POSSIBLE 800
#define GLUT_LAYER_IN_USE 801
#define GLUT_HAS_OVERLAY 802
#define GLUT_TRANSPARENT_INDEX 803
#define GLUT_NORMAL_DAMAGED 804
#define GLUT_OVERLAY_DAMAGED 805
/* glutVideoResizeGet parameters. */
#define GLUT_VIDEO_RESIZE_POSSIBLE 900
#define GLUT_VIDEO_RESIZE_IN_USE 901
#define GLUT_VIDEO_RESIZE_X_DELTA 902
#define GLUT_VIDEO_RESIZE_Y_DELTA 903
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
#define GLUT_VIDEO_RESIZE_X 906
#define GLUT_VIDEO_RESIZE_Y 907
#define GLUT_VIDEO_RESIZE_WIDTH 908
#define GLUT_VIDEO_RESIZE_HEIGHT 909
/* glutUseLayer parameters. */
#define GLUT_NORMAL 0
#define GLUT_OVERLAY 1
/* glutGetModifiers return mask. */
#define GLUT_ACTIVE_SHIFT 1
#define GLUT_ACTIVE_CTRL 2
#define GLUT_ACTIVE_ALT 4
/* glutSetCursor parameters. */
/* Basic arrows. */
#define GLUT_CURSOR_RIGHT_ARROW 0
#define GLUT_CURSOR_LEFT_ARROW 1
/* Symbolic cursor shapes. */
#define GLUT_CURSOR_INFO 2
#define GLUT_CURSOR_DESTROY 3
#define GLUT_CURSOR_HELP 4
#define GLUT_CURSOR_CYCLE 5
#define GLUT_CURSOR_SPRAY 6
#define GLUT_CURSOR_WAIT 7
#define GLUT_CURSOR_TEXT 8
#define GLUT_CURSOR_CROSSHAIR 9
/* Directional cursors. */
#define GLUT_CURSOR_UP_DOWN 10
#define GLUT_CURSOR_LEFT_RIGHT 11
/* Sizing cursors. */
#define GLUT_CURSOR_TOP_SIDE 12
#define GLUT_CURSOR_BOTTOM_SIDE 13
#define GLUT_CURSOR_LEFT_SIDE 14
#define GLUT_CURSOR_RIGHT_SIDE 15
#define GLUT_CURSOR_TOP_LEFT_CORNER 16
#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
/* Inherit from parent window. */
#define GLUT_CURSOR_INHERIT 100
/* Blank cursor. */
#define GLUT_CURSOR_NONE 101
/* Fullscreen crosshair (if available). */
#define GLUT_CURSOR_FULL_CROSSHAIR 102
/* GLUT initialization sub-API. */
GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
GLUTAPI void APIENTRY glutMainLoop(void);
/* GLUT window sub-API. */
GLUTAPI int APIENTRY glutCreateWindow(const char *title);
GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
GLUTAPI void APIENTRY glutDestroyWindow(int win);
GLUTAPI void APIENTRY glutPostRedisplay(void);
GLUTAPI void APIENTRY glutSwapBuffers(void);
GLUTAPI int APIENTRY glutGetWindow(void);
GLUTAPI void APIENTRY glutSetWindow(int win);
GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
GLUTAPI void APIENTRY glutPopWindow(void);
GLUTAPI void APIENTRY glutPushWindow(void);
GLUTAPI void APIENTRY glutIconifyWindow(void);
GLUTAPI void APIENTRY glutShowWindow(void);
GLUTAPI void APIENTRY glutHideWindow(void);
/* GLUT overlay sub-API. */
GLUTAPI void APIENTRY glutEstablishOverlay(void);
GLUTAPI void APIENTRY glutRemoveOverlay(void);
GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
GLUTAPI void APIENTRY glutShowOverlay(void);
GLUTAPI void APIENTRY glutHideOverlay(void);
/* GLUT menu sub-API. */
GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *)(int));
GLUTAPI void APIENTRY glutDestroyMenu(int menu);
GLUTAPI int APIENTRY glutGetMenu(void);
GLUTAPI void APIENTRY glutSetMenu(int menu);
GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
GLUTAPI void APIENTRY glutAttachMenu(int button);
GLUTAPI void APIENTRY glutDetachMenu(int button);
/* GLUT window callback sub-API. */
GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
/* GLUT color index sub-API. */
GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
GLUTAPI void APIENTRY glutCopyColormap(int win);
/* GLUT state retrieval sub-API. */
GLUTAPI int APIENTRY glutGet(GLenum type);
GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
/* GLUT font sub-API */
GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
/* GLUT pre-built models sub-API */
GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUTAPI void APIENTRY glutWireCube(GLdouble size);
GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUTAPI void APIENTRY glutWireDodecahedron(void);
GLUTAPI void APIENTRY glutSolidDodecahedron(void);
GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
GLUTAPI void APIENTRY glutWireOctahedron(void);
GLUTAPI void APIENTRY glutSolidOctahedron(void);
GLUTAPI void APIENTRY glutWireTetrahedron(void);
GLUTAPI void APIENTRY glutSolidTetrahedron(void);
GLUTAPI void APIENTRY glutWireIcosahedron(void);
GLUTAPI void APIENTRY glutSolidIcosahedron(void);
#endif /* __AGLUT_H__ */

View File

@@ -1,81 +0,0 @@
#ifndef __glutf90_h__
#define __glutf90_h__
/* Copyright (c) Mark J. Kilgard & Willam F. Mitchell, 1998. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
/* This header provides the binding interface for William Mitchell's
f90gl Fortran 90 GLUT binding. Other GLUT language bindings
can and should use this interace. */
/* I appreciate the guidance from William Mitchell
(mitchell@cam.nist.gov) in developing this friend interface
for use by the f90gl package. See ../../README.fortran */
#include <GL/glut.h>
/* Which callback enumerants for the __glutSetFCB/__glutGetFCB routines. */
/* NOTE These values are part of a binary interface for the f90gl Fortran
90 binding and so must NOT changes (additions are allowed). */
/* GLUTwindow callbacks. */
#define GLUT_FCB_DISPLAY 0 /* GLUTdisplayFCB */
#define GLUT_FCB_RESHAPE 1 /* GLUTreshapeFCB */
#define GLUT_FCB_MOUSE 2 /* GLUTmouseFCB */
#define GLUT_FCB_MOTION 3 /* GLUTmotionFCB */
#define GLUT_FCB_PASSIVE 4 /* GLUTpassiveFCB */
#define GLUT_FCB_ENTRY 5 /* GLUTentryFCB */
#define GLUT_FCB_KEYBOARD 6 /* GLUTkeyboardFCB */
#define GLUT_FCB_KEYBOARD_UP 7 /* GLUTkeyboardFCB */
#define GLUT_FCB_WINDOW_STATUS 8 /* GLUTwindowStatusFCB */
#define GLUT_FCB_VISIBILITY 9 /* GLUTvisibilityFCB */
#define GLUT_FCB_SPECIAL 10 /* GLUTspecialFCB */
#define GLUT_FCB_SPECIAL_UP 11 /* GLUTspecialFCB */
#define GLUT_FCB_BUTTON_BOX 12 /* GLUTbuttonBoxFCB */
#define GLUT_FCB_DIALS 13 /* GLUTdialsFCB */
#define GLUT_FCB_SPACE_MOTION 14 /* GLUTspaceMotionFCB */
#define GLUT_FCB_SPACE_ROTATE 15 /* GLUTspaceRotateFCB */
#define GLUT_FCB_SPACE_BUTTON 16 /* GLUTspaceButtonFCB */
#define GLUT_FCB_TABLET_MOTION 17 /* GLUTtabletMotionFCB */
#define GLUT_FCB_TABLET_BUTTON 18 /* GLUTtabletButtonFCB */
#define GLUT_FCB_JOYSTICK 19 /* GLUTjoystickFCB */
/* Non-GLUTwindow callbacks. */
#define GLUT_FCB_OVERLAY_DISPLAY 100 /* GLUTdisplayFCB */
#define GLUT_FCB_SELECT 101 /* GLUTselectFCB */
#define GLUT_FCB_TIMER 102 /* GLUTtimerFCB */
/* GLUT Fortran callback function types. */
typedef void (GLUTCALLBACK *GLUTdisplayFCB) (void);
typedef void (GLUTCALLBACK *GLUTreshapeFCB) (int *, int *);
/* NOTE the pressed key is int, not unsigned char for Fortran! */
typedef void (GLUTCALLBACK *GLUTkeyboardFCB) (int *, int *, int *);
typedef void (GLUTCALLBACK *GLUTmouseFCB) (int *, int *, int *, int *);
typedef void (GLUTCALLBACK *GLUTmotionFCB) (int *, int *);
typedef void (GLUTCALLBACK *GLUTpassiveFCB) (int *, int *);
typedef void (GLUTCALLBACK *GLUTentryFCB) (int *);
typedef void (GLUTCALLBACK *GLUTwindowStatusFCB) (int *);
typedef void (GLUTCALLBACK *GLUTvisibilityFCB) (int *);
typedef void (GLUTCALLBACK *GLUTspecialFCB) (int *, int *, int *);
typedef void (GLUTCALLBACK *GLUTbuttonBoxFCB) (int *, int *);
typedef void (GLUTCALLBACK *GLUTdialsFCB) (int *, int *);
typedef void (GLUTCALLBACK *GLUTspaceMotionFCB) (int *, int *, int *);
typedef void (GLUTCALLBACK *GLUTspaceRotateFCB) (int *, int *, int *);
typedef void (GLUTCALLBACK *GLUTspaceButtonFCB) (int *, int *);
typedef void (GLUTCALLBACK *GLUTtabletMotionFCB) (int *, int *);
typedef void (GLUTCALLBACK *GLUTtabletButtonFCB) (int *, int *, int *, int *);
typedef void (GLUTCALLBACK *GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z);
typedef void (GLUTCALLBACK *GLUTselectFCB) (int *);
typedef void (GLUTCALLBACK *GLUTtimerFCB) (int *);
typedef void (GLUTCALLBACK *GLUTmenuStateFCB) (int *); /* DEPRICATED. */
typedef void (GLUTCALLBACK *GLUTmenuStatusFCB) (int *, int *, int *);
typedef void (GLUTCALLBACK *GLUTidleFCB) (void);
/* Functions that set and return Fortran callback functions. */
GLUTAPI GLUTproc APIENTRY __glutGetFCB(int which);
GLUTAPI void APIENTRY __glutSetFCB(int which, GLUTproc func);
#endif /* __glutf90_h__ */

View File

@@ -1,686 +0,0 @@
/* $Revision: 6822 $ on $Date:: 2008-10-30 05:14:19 -0400 #$ */
/*------------------------------------------------------------------------
*
* OpenVG 1.0.1 Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief OpenVG 1.0.1 API.
*//*-------------------------------------------------------------------*/
#ifndef _OPENVG_H
#define _OPENVG_H
#include <VG/vgplatform.h>
#ifdef __cplusplus
extern "C" {
#endif
#define OPENVG_VERSION_1_0 1
#define OPENVG_VERSION_1_0_1 1
#ifndef VG_MAXSHORT
#define VG_MAXSHORT 0x7FFF
#endif
#ifndef VG_MAXINT
#define VG_MAXINT 0x7FFFFFFF
#endif
#ifndef VG_MAX_ENUM
#define VG_MAX_ENUM 0x7FFFFFFF
#endif
typedef long VGHandle;
typedef VGHandle VGPath;
typedef VGHandle VGImage;
typedef VGHandle VGPaint;
#define VG_INVALID_HANDLE ((VGHandle)0)
typedef enum {
VG_FALSE = 0,
VG_TRUE = 1,
VG_BOOLEAN_FORCE_SIZE = VG_MAX_ENUM
} VGboolean;
typedef enum {
VG_NO_ERROR = 0,
VG_BAD_HANDLE_ERROR = 0x1000,
VG_ILLEGAL_ARGUMENT_ERROR = 0x1001,
VG_OUT_OF_MEMORY_ERROR = 0x1002,
VG_PATH_CAPABILITY_ERROR = 0x1003,
VG_UNSUPPORTED_IMAGE_FORMAT_ERROR = 0x1004,
VG_UNSUPPORTED_PATH_FORMAT_ERROR = 0x1005,
VG_IMAGE_IN_USE_ERROR = 0x1006,
VG_NO_CONTEXT_ERROR = 0x1007,
VG_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM
} VGErrorCode;
typedef enum {
/* Mode settings */
VG_MATRIX_MODE = 0x1100,
VG_FILL_RULE = 0x1101,
VG_IMAGE_QUALITY = 0x1102,
VG_RENDERING_QUALITY = 0x1103,
VG_BLEND_MODE = 0x1104,
VG_IMAGE_MODE = 0x1105,
/* Scissoring rectangles */
VG_SCISSOR_RECTS = 0x1106,
/* Stroke parameters */
VG_STROKE_LINE_WIDTH = 0x1110,
VG_STROKE_CAP_STYLE = 0x1111,
VG_STROKE_JOIN_STYLE = 0x1112,
VG_STROKE_MITER_LIMIT = 0x1113,
VG_STROKE_DASH_PATTERN = 0x1114,
VG_STROKE_DASH_PHASE = 0x1115,
VG_STROKE_DASH_PHASE_RESET = 0x1116,
/* Edge fill color for VG_TILE_FILL tiling mode */
VG_TILE_FILL_COLOR = 0x1120,
/* Color for vgClear */
VG_CLEAR_COLOR = 0x1121,
/* Enable/disable alpha masking and scissoring */
VG_MASKING = 0x1130,
VG_SCISSORING = 0x1131,
/* Pixel layout information */
VG_PIXEL_LAYOUT = 0x1140,
VG_SCREEN_LAYOUT = 0x1141,
/* Source format selection for image filters */
VG_FILTER_FORMAT_LINEAR = 0x1150,
VG_FILTER_FORMAT_PREMULTIPLIED = 0x1151,
/* Destination write enable mask for image filters */
VG_FILTER_CHANNEL_MASK = 0x1152,
/* Implementation limits (read-only) */
VG_MAX_SCISSOR_RECTS = 0x1160,
VG_MAX_DASH_COUNT = 0x1161,
VG_MAX_KERNEL_SIZE = 0x1162,
VG_MAX_SEPARABLE_KERNEL_SIZE = 0x1163,
VG_MAX_COLOR_RAMP_STOPS = 0x1164,
VG_MAX_IMAGE_WIDTH = 0x1165,
VG_MAX_IMAGE_HEIGHT = 0x1166,
VG_MAX_IMAGE_PIXELS = 0x1167,
VG_MAX_IMAGE_BYTES = 0x1168,
VG_MAX_FLOAT = 0x1169,
VG_MAX_GAUSSIAN_STD_DEVIATION = 0x116A,
VG_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGParamType;
typedef enum {
VG_RENDERING_QUALITY_NONANTIALIASED = 0x1200,
VG_RENDERING_QUALITY_FASTER = 0x1201,
VG_RENDERING_QUALITY_BETTER = 0x1202, /* Default */
VG_RENDERING_QUALITY_FORCE_SIZE = VG_MAX_ENUM
} VGRenderingQuality;
typedef enum {
VG_PIXEL_LAYOUT_UNKNOWN = 0x1300,
VG_PIXEL_LAYOUT_RGB_VERTICAL = 0x1301,
VG_PIXEL_LAYOUT_BGR_VERTICAL = 0x1302,
VG_PIXEL_LAYOUT_RGB_HORIZONTAL = 0x1303,
VG_PIXEL_LAYOUT_BGR_HORIZONTAL = 0x1304,
VG_PIXEL_LAYOUT_FORCE_SIZE = VG_MAX_ENUM
} VGPixelLayout;
typedef enum {
VG_MATRIX_PATH_USER_TO_SURFACE = 0x1400,
VG_MATRIX_IMAGE_USER_TO_SURFACE = 0x1401,
VG_MATRIX_FILL_PAINT_TO_USER = 0x1402,
VG_MATRIX_STROKE_PAINT_TO_USER = 0x1403,
VG_MATRIX_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGMatrixMode;
typedef enum {
VG_CLEAR_MASK = 0x1500,
VG_FILL_MASK = 0x1501,
VG_SET_MASK = 0x1502,
VG_UNION_MASK = 0x1503,
VG_INTERSECT_MASK = 0x1504,
VG_SUBTRACT_MASK = 0x1505,
VG_MASK_OPERATION_FORCE_SIZE = VG_MAX_ENUM
} VGMaskOperation;
#define VG_PATH_FORMAT_STANDARD 0
typedef enum {
VG_PATH_DATATYPE_S_8 = 0,
VG_PATH_DATATYPE_S_16 = 1,
VG_PATH_DATATYPE_S_32 = 2,
VG_PATH_DATATYPE_F = 3,
VG_PATH_DATATYPE_FORCE_SIZE = VG_MAX_ENUM
} VGPathDatatype;
typedef enum {
VG_ABSOLUTE = 0,
VG_RELATIVE = 1,
VG_PATH_ABS_REL_FORCE_SIZE = VG_MAX_ENUM
} VGPathAbsRel;
typedef enum {
VG_CLOSE_PATH = ( 0 << 1),
VG_MOVE_TO = ( 1 << 1),
VG_LINE_TO = ( 2 << 1),
VG_HLINE_TO = ( 3 << 1),
VG_VLINE_TO = ( 4 << 1),
VG_QUAD_TO = ( 5 << 1),
VG_CUBIC_TO = ( 6 << 1),
VG_SQUAD_TO = ( 7 << 1),
VG_SCUBIC_TO = ( 8 << 1),
VG_SCCWARC_TO = ( 9 << 1),
VG_SCWARC_TO = (10 << 1),
VG_LCCWARC_TO = (11 << 1),
VG_LCWARC_TO = (12 << 1),
VG_PATH_SEGMENT_FORCE_SIZE = VG_MAX_ENUM
} VGPathSegment;
typedef enum {
VG_MOVE_TO_ABS = VG_MOVE_TO | VG_ABSOLUTE,
VG_MOVE_TO_REL = VG_MOVE_TO | VG_RELATIVE,
VG_LINE_TO_ABS = VG_LINE_TO | VG_ABSOLUTE,
VG_LINE_TO_REL = VG_LINE_TO | VG_RELATIVE,
VG_HLINE_TO_ABS = VG_HLINE_TO | VG_ABSOLUTE,
VG_HLINE_TO_REL = VG_HLINE_TO | VG_RELATIVE,
VG_VLINE_TO_ABS = VG_VLINE_TO | VG_ABSOLUTE,
VG_VLINE_TO_REL = VG_VLINE_TO | VG_RELATIVE,
VG_QUAD_TO_ABS = VG_QUAD_TO | VG_ABSOLUTE,
VG_QUAD_TO_REL = VG_QUAD_TO | VG_RELATIVE,
VG_CUBIC_TO_ABS = VG_CUBIC_TO | VG_ABSOLUTE,
VG_CUBIC_TO_REL = VG_CUBIC_TO | VG_RELATIVE,
VG_SQUAD_TO_ABS = VG_SQUAD_TO | VG_ABSOLUTE,
VG_SQUAD_TO_REL = VG_SQUAD_TO | VG_RELATIVE,
VG_SCUBIC_TO_ABS = VG_SCUBIC_TO | VG_ABSOLUTE,
VG_SCUBIC_TO_REL = VG_SCUBIC_TO | VG_RELATIVE,
VG_SCCWARC_TO_ABS = VG_SCCWARC_TO | VG_ABSOLUTE,
VG_SCCWARC_TO_REL = VG_SCCWARC_TO | VG_RELATIVE,
VG_SCWARC_TO_ABS = VG_SCWARC_TO | VG_ABSOLUTE,
VG_SCWARC_TO_REL = VG_SCWARC_TO | VG_RELATIVE,
VG_LCCWARC_TO_ABS = VG_LCCWARC_TO | VG_ABSOLUTE,
VG_LCCWARC_TO_REL = VG_LCCWARC_TO | VG_RELATIVE,
VG_LCWARC_TO_ABS = VG_LCWARC_TO | VG_ABSOLUTE,
VG_LCWARC_TO_REL = VG_LCWARC_TO | VG_RELATIVE,
VG_PATH_COMMAND_FORCE_SIZE = VG_MAX_ENUM
} VGPathCommand;
typedef enum {
VG_PATH_CAPABILITY_APPEND_FROM = (1 << 0),
VG_PATH_CAPABILITY_APPEND_TO = (1 << 1),
VG_PATH_CAPABILITY_MODIFY = (1 << 2),
VG_PATH_CAPABILITY_TRANSFORM_FROM = (1 << 3),
VG_PATH_CAPABILITY_TRANSFORM_TO = (1 << 4),
VG_PATH_CAPABILITY_INTERPOLATE_FROM = (1 << 5),
VG_PATH_CAPABILITY_INTERPOLATE_TO = (1 << 6),
VG_PATH_CAPABILITY_PATH_LENGTH = (1 << 7),
VG_PATH_CAPABILITY_POINT_ALONG_PATH = (1 << 8),
VG_PATH_CAPABILITY_TANGENT_ALONG_PATH = (1 << 9),
VG_PATH_CAPABILITY_PATH_BOUNDS = (1 << 10),
VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS = (1 << 11),
VG_PATH_CAPABILITY_ALL = (1 << 12) - 1,
VG_PATH_CAPABILITIES_FORCE_SIZE = VG_MAX_ENUM
} VGPathCapabilities;
typedef enum {
VG_PATH_FORMAT = 0x1600,
VG_PATH_DATATYPE = 0x1601,
VG_PATH_SCALE = 0x1602,
VG_PATH_BIAS = 0x1603,
VG_PATH_NUM_SEGMENTS = 0x1604,
VG_PATH_NUM_COORDS = 0x1605,
VG_PATH_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGPathParamType;
typedef enum {
VG_CAP_BUTT = 0x1700,
VG_CAP_ROUND = 0x1701,
VG_CAP_SQUARE = 0x1702,
VG_CAP_STYLE_FORCE_SIZE = VG_MAX_ENUM
} VGCapStyle;
typedef enum {
VG_JOIN_MITER = 0x1800,
VG_JOIN_ROUND = 0x1801,
VG_JOIN_BEVEL = 0x1802,
VG_JOIN_STYLE_FORCE_SIZE = VG_MAX_ENUM
} VGJoinStyle;
typedef enum {
VG_EVEN_ODD = 0x1900,
VG_NON_ZERO = 0x1901,
VG_FILL_RULE_FORCE_SIZE = VG_MAX_ENUM
} VGFillRule;
typedef enum {
VG_STROKE_PATH = (1 << 0),
VG_FILL_PATH = (1 << 1),
VG_PAINT_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGPaintMode;
typedef enum {
/* Color paint parameters */
VG_PAINT_TYPE = 0x1A00,
VG_PAINT_COLOR = 0x1A01,
VG_PAINT_COLOR_RAMP_SPREAD_MODE = 0x1A02,
VG_PAINT_COLOR_RAMP_PREMULTIPLIED = 0x1A07,
VG_PAINT_COLOR_RAMP_STOPS = 0x1A03,
/* Linear gradient paint parameters */
VG_PAINT_LINEAR_GRADIENT = 0x1A04,
/* Radial gradient paint parameters */
VG_PAINT_RADIAL_GRADIENT = 0x1A05,
/* Pattern paint parameters */
VG_PAINT_PATTERN_TILING_MODE = 0x1A06,
VG_PAINT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGPaintParamType;
typedef enum {
VG_PAINT_TYPE_COLOR = 0x1B00,
VG_PAINT_TYPE_LINEAR_GRADIENT = 0x1B01,
VG_PAINT_TYPE_RADIAL_GRADIENT = 0x1B02,
VG_PAINT_TYPE_PATTERN = 0x1B03,
VG_PAINT_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGPaintType;
typedef enum {
VG_COLOR_RAMP_SPREAD_PAD = 0x1C00,
VG_COLOR_RAMP_SPREAD_REPEAT = 0x1C01,
VG_COLOR_RAMP_SPREAD_REFLECT = 0x1C02,
VG_COLOR_RAMP_SPREAD_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGColorRampSpreadMode;
typedef enum {
VG_TILE_FILL = 0x1D00,
VG_TILE_PAD = 0x1D01,
VG_TILE_REPEAT = 0x1D02,
VG_TILE_REFLECT = 0x1D03,
VG_TILING_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGTilingMode;
typedef enum {
/* RGB{A,X} channel ordering */
VG_sRGBX_8888 = 0,
VG_sRGBA_8888 = 1,
VG_sRGBA_8888_PRE = 2,
VG_sRGB_565 = 3,
VG_sRGBA_5551 = 4,
VG_sRGBA_4444 = 5,
VG_sL_8 = 6,
VG_lRGBX_8888 = 7,
VG_lRGBA_8888 = 8,
VG_lRGBA_8888_PRE = 9,
VG_lL_8 = 10,
VG_A_8 = 11,
VG_BW_1 = 12,
/* {A,X}RGB channel ordering */
VG_sXRGB_8888 = 0 | (1 << 6),
VG_sARGB_8888 = 1 | (1 << 6),
VG_sARGB_8888_PRE = 2 | (1 << 6),
VG_sARGB_1555 = 4 | (1 << 6),
VG_sARGB_4444 = 5 | (1 << 6),
VG_lXRGB_8888 = 7 | (1 << 6),
VG_lARGB_8888 = 8 | (1 << 6),
VG_lARGB_8888_PRE = 9 | (1 << 6),
/* BGR{A,X} channel ordering */
VG_sBGRX_8888 = 0 | (1 << 7),
VG_sBGRA_8888 = 1 | (1 << 7),
VG_sBGRA_8888_PRE = 2 | (1 << 7),
VG_sBGR_565 = 3 | (1 << 7),
VG_sBGRA_5551 = 4 | (1 << 7),
VG_sBGRA_4444 = 5 | (1 << 7),
VG_lBGRX_8888 = 7 | (1 << 7),
VG_lBGRA_8888 = 8 | (1 << 7),
VG_lBGRA_8888_PRE = 9 | (1 << 7),
/* {A,X}BGR channel ordering */
VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7),
VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7),
VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7),
VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7),
VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7),
VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7),
VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7),
VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7),
VG_IMAGE_FORMAT_FORCE_SIZE = VG_MAX_ENUM
} VGImageFormat;
typedef enum {
VG_IMAGE_QUALITY_NONANTIALIASED = (1 << 0),
VG_IMAGE_QUALITY_FASTER = (1 << 1),
VG_IMAGE_QUALITY_BETTER = (1 << 2),
VG_IMAGE_QUALITY_FORCE_SIZE = VG_MAX_ENUM
} VGImageQuality;
typedef enum {
VG_IMAGE_FORMAT = 0x1E00,
VG_IMAGE_WIDTH = 0x1E01,
VG_IMAGE_HEIGHT = 0x1E02,
VG_IMAGE_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGImageParamType;
typedef enum {
VG_DRAW_IMAGE_NORMAL = 0x1F00,
VG_DRAW_IMAGE_MULTIPLY = 0x1F01,
VG_DRAW_IMAGE_STENCIL = 0x1F02,
VG_IMAGE_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGImageMode;
typedef enum {
VG_RED = (1 << 3),
VG_GREEN = (1 << 2),
VG_BLUE = (1 << 1),
VG_ALPHA = (1 << 0),
VG_IMAGE_CHANNEL_FORCE_SIZE = VG_MAX_ENUM
} VGImageChannel;
typedef enum {
VG_BLEND_SRC = 0x2000,
VG_BLEND_SRC_OVER = 0x2001,
VG_BLEND_DST_OVER = 0x2002,
VG_BLEND_SRC_IN = 0x2003,
VG_BLEND_DST_IN = 0x2004,
VG_BLEND_MULTIPLY = 0x2005,
VG_BLEND_SCREEN = 0x2006,
VG_BLEND_DARKEN = 0x2007,
VG_BLEND_LIGHTEN = 0x2008,
VG_BLEND_ADDITIVE = 0x2009,
VG_BLEND_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGBlendMode;
typedef enum {
VG_IMAGE_FORMAT_QUERY = 0x2100,
VG_PATH_DATATYPE_QUERY = 0x2101,
VG_HARDWARE_QUERY_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGHardwareQueryType;
typedef enum {
VG_HARDWARE_ACCELERATED = 0x2200,
VG_HARDWARE_UNACCELERATED = 0x2201,
VG_HARDWARE_QUERY_RESULT_FORCE_SIZE = VG_MAX_ENUM
} VGHardwareQueryResult;
typedef enum {
VG_VENDOR = 0x2300,
VG_RENDERER = 0x2301,
VG_VERSION = 0x2302,
VG_EXTENSIONS = 0x2303,
VG_STRING_ID_FORCE_SIZE = VG_MAX_ENUM
} VGStringID;
/* Function Prototypes */
#ifndef VG_API_CALL
# error VG_API_CALL must be defined
#endif
#ifndef VG_API_ENTRY
# error VG_API_ENTRY must be defined
#endif
#ifndef VG_API_EXIT
# error VG_API_EXIT must be defined
#endif
VG_API_CALL VGErrorCode VG_API_ENTRY vgGetError(void) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgFlush(void) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgFinish(void) VG_API_EXIT;
/* Getters and Setters */
VG_API_CALL void VG_API_ENTRY vgSetf (VGParamType type, VGfloat value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSeti (VGParamType type, VGint value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetfv(VGParamType type, VGint count,
const VGfloat * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetiv(VGParamType type, VGint count,
const VGint * values) VG_API_EXIT;
VG_API_CALL VGfloat VG_API_ENTRY vgGetf(VGParamType type) VG_API_EXIT;
VG_API_CALL VGint VG_API_ENTRY vgGeti(VGParamType type) VG_API_EXIT;
VG_API_CALL VGint VG_API_ENTRY vgGetVectorSize(VGParamType type) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetfv(VGParamType type, VGint count, VGfloat * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetiv(VGParamType type, VGint count, VGint * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetParameterf(VGHandle object,
VGint paramType,
VGfloat value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetParameteri(VGHandle object,
VGint paramType,
VGint value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetParameterfv(VGHandle object,
VGint paramType,
VGint count, const VGfloat * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetParameteriv(VGHandle object,
VGint paramType,
VGint count, const VGint * values) VG_API_EXIT;
VG_API_CALL VGfloat VG_API_ENTRY vgGetParameterf(VGHandle object,
VGint paramType) VG_API_EXIT;
VG_API_CALL VGint VG_API_ENTRY vgGetParameteri(VGHandle object,
VGint paramType);
VG_API_CALL VGint VG_API_ENTRY vgGetParameterVectorSize(VGHandle object,
VGint paramType) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetParameterfv(VGHandle object,
VGint paramType,
VGint count, VGfloat * values) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetParameteriv(VGHandle object,
VGint paramType,
VGint count, VGint * values) VG_API_EXIT;
/* Matrix Manipulation */
VG_API_CALL void VG_API_ENTRY vgLoadIdentity(void) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgLoadMatrix(const VGfloat * m) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetMatrix(VGfloat * m) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgMultMatrix(const VGfloat * m) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgTranslate(VGfloat tx, VGfloat ty) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgScale(VGfloat sx, VGfloat sy) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgShear(VGfloat shx, VGfloat shy) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgRotate(VGfloat angle) VG_API_EXIT;
/* Masking and Clearing */
VG_API_CALL void VG_API_ENTRY vgMask(VGImage mask, VGMaskOperation operation,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgClear(VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
/* Paths */
VG_API_CALL VGPath VG_API_ENTRY vgCreatePath(VGint pathFormat,
VGPathDatatype datatype,
VGfloat scale, VGfloat bias,
VGint segmentCapacityHint,
VGint coordCapacityHint,
VGbitfield capabilities) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgClearPath(VGPath path, VGbitfield capabilities) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDestroyPath(VGPath path) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgRemovePathCapabilities(VGPath path,
VGbitfield capabilities) VG_API_EXIT;
VG_API_CALL VGbitfield VG_API_ENTRY vgGetPathCapabilities(VGPath path) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgAppendPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgAppendPathData(VGPath dstPath,
VGint numSegments,
const VGubyte * pathSegments,
const void * pathData) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgModifyPathCoords(VGPath dstPath, VGint startIndex,
VGint numSegments,
const void * pathData) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgTransformPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT;
VG_API_CALL VGboolean VG_API_ENTRY vgInterpolatePath(VGPath dstPath,
VGPath startPath,
VGPath endPath,
VGfloat amount) VG_API_EXIT;
VG_API_CALL VGfloat VG_API_ENTRY vgPathLength(VGPath path,
VGint startSegment, VGint numSegments) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgPointAlongPath(VGPath path,
VGint startSegment, VGint numSegments,
VGfloat distance,
VGfloat * x, VGfloat * y,
VGfloat * tangentX, VGfloat * tangentY) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgPathBounds(VGPath path,
VGfloat * minX, VGfloat * minY,
VGfloat * width, VGfloat * height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgPathTransformedBounds(VGPath path,
VGfloat * minX, VGfloat * minY,
VGfloat * width, VGfloat * height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDrawPath(VGPath path, VGbitfield paintModes) VG_API_EXIT;
/* Paint */
VG_API_CALL VGPaint VG_API_ENTRY vgCreatePaint(void) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDestroyPaint(VGPaint paint) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetPaint(VGPaint paint, VGbitfield paintModes) VG_API_EXIT;
VG_API_CALL VGPaint VG_API_ENTRY vgGetPaint(VGPaintMode paintMode) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetColor(VGPaint paint, VGuint rgba) VG_API_EXIT;
VG_API_CALL VGuint VG_API_ENTRY vgGetColor(VGPaint paint) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgPaintPattern(VGPaint paint, VGImage pattern) VG_API_EXIT;
/* Images */
VG_API_CALL VGImage VG_API_ENTRY vgCreateImage(VGImageFormat format,
VGint width, VGint height,
VGbitfield allowedQuality) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDestroyImage(VGImage image) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgClearImage(VGImage image,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgImageSubData(VGImage image,
const void * data, VGint dataStride,
VGImageFormat dataFormat,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetImageSubData(VGImage image,
void * data, VGint dataStride,
VGImageFormat dataFormat,
VGint x, VGint y,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL VGImage VG_API_ENTRY vgChildImage(VGImage parent,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL VGImage VG_API_ENTRY vgGetParent(VGImage image) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgCopyImage(VGImage dst, VGint dx, VGint dy,
VGImage src, VGint sx, VGint sy,
VGint width, VGint height,
VGboolean dither) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDrawImage(VGImage image) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetPixels(VGint dx, VGint dy,
VGImage src, VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgWritePixels(const void * data, VGint dataStride,
VGImageFormat dataFormat,
VGint dx, VGint dy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGetPixels(VGImage dst, VGint dx, VGint dy,
VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgReadPixels(void * data, VGint dataStride,
VGImageFormat dataFormat,
VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgCopyPixels(VGint dx, VGint dy,
VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
/* Image Filters */
VG_API_CALL void VG_API_ENTRY vgColorMatrix(VGImage dst, VGImage src,
const VGfloat * matrix) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgConvolve(VGImage dst, VGImage src,
VGint kernelWidth, VGint kernelHeight,
VGint shiftX, VGint shiftY,
const VGshort * kernel,
VGfloat scale,
VGfloat bias,
VGTilingMode tilingMode) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSeparableConvolve(VGImage dst, VGImage src,
VGint kernelWidth,
VGint kernelHeight,
VGint shiftX, VGint shiftY,
const VGshort * kernelX,
const VGshort * kernelY,
VGfloat scale,
VGfloat bias,
VGTilingMode tilingMode) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgGaussianBlur(VGImage dst, VGImage src,
VGfloat stdDeviationX,
VGfloat stdDeviationY,
VGTilingMode tilingMode) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgLookup(VGImage dst, VGImage src,
const VGubyte * redLUT,
const VGubyte * greenLUT,
const VGubyte * blueLUT,
const VGubyte * alphaLUT,
VGboolean outputLinear,
VGboolean outputPremultiplied) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgLookupSingle(VGImage dst, VGImage src,
const VGuint * lookupTable,
VGImageChannel sourceChannel,
VGboolean outputLinear,
VGboolean outputPremultiplied) VG_API_EXIT;
/* Hardware Queries */
VG_API_CALL VGHardwareQueryResult VG_API_ENTRY vgHardwareQuery(VGHardwareQueryType key,
VGint setting) VG_API_EXIT;
/* Renderer and Extension Information */
VG_API_CALL const VGubyte * VG_API_ENTRY vgGetString(VGStringID name) VG_API_EXIT;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _OPENVG_H */

View File

@@ -1,233 +0,0 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VG extensions Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VG extensions
*//*-------------------------------------------------------------------*/
#ifndef _VGEXT_H
#define _VGEXT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <VG/openvg.h>
#include <VG/vgu.h>
#ifndef VG_API_ENTRYP
# define VG_API_ENTRYP VG_API_ENTRY*
#endif
#ifndef VGU_API_ENTRYP
# define VGU_API_ENTRYP VGU_API_ENTRY*
#endif
/*-------------------------------------------------------------------------------
* KHR extensions
*------------------------------------------------------------------------------*/
typedef enum {
#ifndef VG_KHR_iterative_average_blur
VG_MAX_AVERAGE_BLUR_DIMENSION_KHR = 0x116B,
VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C,
VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR = 0x116D,
#endif
VG_PARAM_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGParamTypeKHR;
#ifndef VG_KHR_EGL_image
#define VG_KHR_EGL_image 1
/* VGEGLImageKHR is an opaque handle to an EGLImage */
typedef void* VGeglImageKHR;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image);
#endif
typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image);
#endif
#ifndef VG_KHR_iterative_average_blur
#define VG_KHR_iterative_average_blur 1
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
#endif
typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
#endif
#ifndef VG_KHR_advanced_blending
#define VG_KHR_advanced_blending 1
typedef enum {
VG_BLEND_OVERLAY_KHR = 0x2010,
VG_BLEND_HARDLIGHT_KHR = 0x2011,
VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012,
VG_BLEND_SOFTLIGHT_KHR = 0x2013,
VG_BLEND_COLORDODGE_KHR = 0x2014,
VG_BLEND_COLORBURN_KHR = 0x2015,
VG_BLEND_DIFFERENCE_KHR = 0x2016,
VG_BLEND_SUBTRACT_KHR = 0x2017,
VG_BLEND_INVERT_KHR = 0x2018,
VG_BLEND_EXCLUSION_KHR = 0x2019,
VG_BLEND_LINEARDODGE_KHR = 0x201a,
VG_BLEND_LINEARBURN_KHR = 0x201b,
VG_BLEND_VIVIDLIGHT_KHR = 0x201c,
VG_BLEND_LINEARLIGHT_KHR = 0x201d,
VG_BLEND_PINLIGHT_KHR = 0x201e,
VG_BLEND_HARDMIX_KHR = 0x201f,
VG_BLEND_CLEAR_KHR = 0x2020,
VG_BLEND_DST_KHR = 0x2021,
VG_BLEND_SRC_OUT_KHR = 0x2022,
VG_BLEND_DST_OUT_KHR = 0x2023,
VG_BLEND_SRC_ATOP_KHR = 0x2024,
VG_BLEND_DST_ATOP_KHR = 0x2025,
VG_BLEND_XOR_KHR = 0x2026,
VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM
} VGBlendModeKHR;
#endif
#ifndef VG_KHR_parametric_filter
#define VG_KHR_parametric_filter 1
typedef enum {
VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0),
VG_PF_KNOCKOUT_FLAG_KHR = (1 << 1),
VG_PF_OUTER_FLAG_KHR = (1 << 2),
VG_PF_INNER_FLAG_KHR = (1 << 3),
VG_PF_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGPfTypeKHR;
typedef enum {
VGU_IMAGE_IN_USE_ERROR = 0xF010,
VGU_ERROR_CODE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGUErrorCodeKHR;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
#endif
typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
#endif
/*-------------------------------------------------------------------------------
* NDS extensions
*------------------------------------------------------------------------------*/
#ifndef VG_NDS_paint_generation
#define VG_NDS_paint_generation 1
typedef enum {
VG_PAINT_COLOR_RAMP_LINEAR_NDS = 0x1A10,
VG_COLOR_MATRIX_NDS = 0x1A11,
VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS = 0x1A12,
VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPaintParamTypeNds;
typedef enum {
VG_DRAW_IMAGE_COLOR_MATRIX_NDS = 0x1F10,
VG_IMAGE_MODE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGImageModeNds;
#endif
#ifndef VG_NDS_projective_geometry
#define VG_NDS_projective_geometry 1
typedef enum {
VG_CLIP_MODE_NDS = 0x1180,
VG_CLIP_LINES_NDS = 0x1181,
VG_MAX_CLIP_LINES_NDS = 0x1182,
VG_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGParamTypeNds;
typedef enum {
VG_CLIPMODE_NONE_NDS = 0x3000,
VG_CLIPMODE_CLIP_CLOSED_NDS = 0x3001,
VG_CLIPMODE_CLIP_OPEN_NDS = 0x3002,
VG_CLIPMODE_CULL_NDS = 0x3003,
VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGClipModeNds;
typedef enum {
VG_RQUAD_TO_NDS = ( 13 << 1 ),
VG_RCUBIC_TO_NDS = ( 14 << 1 ),
VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPathSegmentNds;
typedef enum {
VG_RQUAD_TO_ABS_NDS = (VG_RQUAD_TO_NDS | VG_ABSOLUTE),
VG_RQUAD_TO_REL_NDS = (VG_RQUAD_TO_NDS | VG_RELATIVE),
VG_RCUBIC_TO_ABS_NDS = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE),
VG_RCUBIC_TO_REL_NDS = (VG_RCUBIC_TO_NDS | VG_RELATIVE),
VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPathCommandNds;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
#endif
typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ;
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _VGEXT_H */

View File

@@ -1,106 +0,0 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VG platform specific header Reference Implementation
* ----------------------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VG platform specific header
*//*-------------------------------------------------------------------*/
#ifndef _VGPLATFORM_H
#define _VGPLATFORM_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef VG_API_CALL
#if defined(OPENVG_STATIC_LIBRARY)
# define VG_API_CALL
#else
# if defined(_WIN32) || defined(__VC32__) /* Win32 */
# if defined (OPENVG_DLL_EXPORTS)
# define VG_API_CALL __declspec(dllexport)
# else
# define VG_API_CALL __declspec(dllimport)
# endif
# else
# define VG_API_CALL extern
# endif /* defined(_WIN32) ||... */
#endif /* defined OPENVG_STATIC_LIBRARY */
#endif /* ifndef VG_API_CALL */
#ifndef VGU_API_CALL
#if defined(OPENVG_STATIC_LIBRARY)
# define VGU_API_CALL
#else
# if defined(_WIN32) || defined(__VC32__) /* Win32 */
# if defined (OPENVG_DLL_EXPORTS)
# define VGU_API_CALL __declspec(dllexport)
# else
# define VGU_API_CALL __declspec(dllimport)
# endif
# else
# define VGU_API_CALL extern
# endif /* defined(_WIN32) ||... */
#endif /* defined OPENVG_STATIC_LIBRARY */
#endif /* ifndef VGU_API_CALL */
#ifndef VG_API_ENTRY
#define VG_API_ENTRY
#endif
#ifndef VG_API_EXIT
#define VG_API_EXIT
#endif
#ifndef VGU_API_ENTRY
#define VGU_API_ENTRY
#endif
#ifndef VGU_API_EXIT
#define VGU_API_EXIT
#endif
typedef float VGfloat;
typedef signed char VGbyte;
typedef unsigned char VGubyte;
typedef signed short VGshort;
typedef signed int VGint;
typedef unsigned int VGuint;
typedef unsigned int VGbitfield;
#ifndef VG_VGEXT_PROTOTYPES
#define VG_VGEXT_PROTOTYPES
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _VGPLATFORM_H */

View File

@@ -1,130 +0,0 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VGU 1.0.1 Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VGU 1.0.1 API.
*//*-------------------------------------------------------------------*/
#ifndef _VGU_H
#define _VGU_H
#ifdef __cplusplus
extern "C" {
#endif
#include <VG/openvg.h>
#define VGU_VERSION_1_0 1
#ifndef VGU_API_CALL
# error VGU_API_CALL must be defined
#endif
#ifndef VGU_API_ENTRY
# error VGU_API_ENTRY must be defined
#endif
#ifndef VGU_API_EXIT
# error VGU_API_EXIT must be defined
#endif
typedef enum {
VGU_NO_ERROR = 0,
VGU_BAD_HANDLE_ERROR = 0xF000,
VGU_ILLEGAL_ARGUMENT_ERROR = 0xF001,
VGU_OUT_OF_MEMORY_ERROR = 0xF002,
VGU_PATH_CAPABILITY_ERROR = 0xF003,
VGU_BAD_WARP_ERROR = 0xF004,
VGU_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM
} VGUErrorCode;
typedef enum {
VGU_ARC_OPEN = 0xF100,
VGU_ARC_CHORD = 0xF101,
VGU_ARC_PIE = 0xF102,
VGU_ARC_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGUArcType;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path,
VGfloat x0, VGfloat y0,
VGfloat x1, VGfloat y1) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path,
const VGfloat * points, VGint count,
VGboolean closed) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height,
VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path,
VGfloat cx, VGfloat cy,
VGfloat width, VGfloat height) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height,
VGfloat startAngle, VGfloat angleExtent,
VGUArcType arcType) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
VGfloat sx3, VGfloat sy3,
VGfloat * matrix) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2,
VGfloat dx3, VGfloat dy3,
VGfloat * matrix) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2,
VGfloat dx3, VGfloat dy3,
VGfloat sx0, VGfloat sy0,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
VGfloat sx3, VGfloat sy3,
VGfloat * matrix) VGU_API_EXIT;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* #ifndef _VGU_H */

View File

@@ -124,13 +124,6 @@ reflect.o: reflect.c showbuffer.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) reflect.c
shadowtex: shadowtex.o showbuffer.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) shadowtex.o showbuffer.o $(LIBS) -o $@
shadowtex.o: shadowtex.c showbuffer.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) shadowtex.c
gloss: gloss.o trackball.o readtex.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) gloss.o trackball.o readtex.o $(LIBS) -o $@

View File

@@ -120,7 +120,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
0.1 /* ConnectingRodThickness */
0.1, /* ConnectingRodThickness */
0, /* CrankList */
0, /* ConnRodList */
0, /* PistonList */
0 /* BlockList */
},
{
"Inline-4",
@@ -136,7 +140,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
0.1 /* ConnectingRodThickness */
0.1, /* ConnectingRodThickness */
0, /* CrankList */
0, /* ConnRodList */
0, /* PistonList */
0 /* BlockList */
},
{
"Boxer-6",
@@ -152,7 +160,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
0.1 /* ConnectingRodThickness */
0.1, /* ConnectingRodThickness */
0, /* CrankList */
0, /* ConnRodList */
0, /* PistonList */
0 /* BlockList */
}
};

View File

@@ -14,7 +14,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "extfuncs.h"
/* For debug */

View File

@@ -6,6 +6,7 @@
* Humanware s.r.l.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -725,8 +726,13 @@ main(int ac, char **av)
maxage = 1.0 / dt;
if (ac == 2)
if (ac == 2) {
np = atoi(av[1]);
if (np <= 0 || np > 1000000) {
fprintf(stderr, "Invalid input.\n");
exit(-1);
}
}
if (ac == 4) {
WIDTH = atoi(av[2]);
@@ -759,7 +765,9 @@ main(int ac, char **av)
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.1);
assert(np > 0);
p = (part *) malloc(sizeof(part) * np);
assert(p);
for (i = 0; i < np; i++)
setnewpart(&p[i]);

View File

@@ -25,6 +25,7 @@
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <GL/glut.h>
@@ -129,8 +130,10 @@ Clear_Buffers ()
static void
LoadTriplet (TDA A)
{
int result;
Clear_Buffers ();
fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4);
result = fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4);
assert(result != EOF);
A[0] = atof (Buf2);
A[1] = atof (Buf3);
A[2] = atof (Buf4);
@@ -140,8 +143,10 @@ LoadTriplet (TDA A)
static void
LoadReal (float *a)
{
int result;
Clear_Buffers ();
fscanf (mainfile, "%s %s", Buf1, Buf2);
result = fscanf (mainfile, "%s %s", Buf1, Buf2);
assert(result != EOF);
*a = atof (Buf2);
}
@@ -149,8 +154,10 @@ LoadReal (float *a)
static void
LoadInteger (int *a)
{
int result;
Clear_Buffers ();
fscanf (mainfile, "%s %s", Buf1, Buf2);
result = fscanf (mainfile, "%s %s", Buf1, Buf2);
assert(result != EOF);
*a = atoi (Buf2);
}
@@ -158,8 +165,10 @@ LoadInteger (int *a)
static void
LoadText (char *a)
{
int result;
Clear_Buffers ();
fscanf (mainfile, "%s %s", Buf1, Buf2);
result = fscanf (mainfile, "%s %s", Buf1, Buf2);
assert(result != EOF);
strcpy (a, Buf2);
}
@@ -177,8 +186,10 @@ getdata (char filename[])
do
{
int result;
Clear_Buffers ();
fscanf (mainfile, "%s", Buf1);
result = fscanf (mainfile, "%s", Buf1);
(void) result;
if (ferror (mainfile))
{
printf ("\nError opening file !\n");

View File

@@ -27,7 +27,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef _WIN32
#include <windows.h>
@@ -132,9 +131,11 @@ static void read_surface( char *filename )
numverts = 0;
while (!feof(f) && numverts<maxverts) {
fscanf( f, "%f %f %f %f %f %f",
&data[numverts][0], &data[numverts][1], &data[numverts][2],
&data[numverts][3], &data[numverts][4], &data[numverts][5] );
int result;
result = fscanf( f, "%f %f %f %f %f %f",
&data[numverts][0], &data[numverts][1], &data[numverts][2],
&data[numverts][3], &data[numverts][4], &data[numverts][5] );
(void) result;
numverts++;
}
numverts--;

View File

@@ -137,7 +137,6 @@ So the angle is:
#endif
#include <GL/glut.h>
#include <math.h>
#include <string.h>
#define Scale 0.3

View File

@@ -219,7 +219,7 @@ Display( void )
GLint reads = 0;
GLint endTime;
GLint startTime = glutGet(GLUT_ELAPSED_TIME);
GLdouble seconds, pixelsPerSecond;
GLdouble seconds, mpixels, mpixelsPerSecond;
printf("Benchmarking...\n");
do {
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
@@ -228,9 +228,10 @@ Display( void )
endTime = glutGet(GLUT_ELAPSED_TIME);
} while (endTime - startTime < 4000); /* 4 seconds */
seconds = (double) (endTime - startTime) / 1000.0;
pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds;
printf("Result: %d reads in %f seconds = %f pixels/sec\n",
reads, seconds, pixelsPerSecond);
mpixels = reads * (ImgWidth * ImgHeight / (1000.0 * 1000.0));
mpixelsPerSecond = mpixels / seconds;
printf("Result: %d reads in %f seconds = %f Mpixels/sec\n",
reads, seconds, mpixelsPerSecond);
Benchmark = GL_FALSE;
}
else {

View File

@@ -38,7 +38,6 @@
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "showbuffer.h"
#define DEG_TO_RAD (3.14159 / 180.0)

View File

@@ -8,6 +8,7 @@
* based on a Mikael SkiZoWalker's (MoDEL) / France (Skizo@Hol.Fr) demo
*/
#include <assert.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
@@ -559,12 +560,14 @@ loadpic(void)
FILE *FilePic;
int i, tmp;
GLenum gluerr;
size_t result;
if ((FilePic = fopen("terrain.dat", "r")) == NULL) {
fprintf(stderr, "Error loading terrain.dat\n");
exit(-1);
}
fread(bufferter, 256 * 256, 1, FilePic);
result = fread(bufferter, 256 * 256, 1, FilePic);
assert(result == 1);
fclose(FilePic);
for (i = 0; i < (256 * 256); i++) {

View File

@@ -57,7 +57,7 @@ Idle(void)
{
Xrot = glutGet(GLUT_ELAPSED_TIME) * 0.02;
Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.04;
/*Zrot += 2.0;*/
/* Zrot += 2.0; */
glutPostRedisplay();
}

12
progs/egl/.gitignore vendored
View File

@@ -1,12 +0,0 @@
demo1
demo2
demo3
eglgears
eglinfo
eglscreen
egltri
peglgears
xeglbindtex
xeglgears
xeglthreads
xegl_tri

View File

@@ -1,119 +0,0 @@
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Stolen from eglgears
*
* Creates a surface and show that on the first screen
*/
#define EGL_EGLEXT_PROTOTYPES
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <GL/gl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#define MAX_CONFIGS 10
#define MAX_MODES 100
int
main(int argc, char *argv[])
{
int maj, min;
EGLSurface screen_surf;
EGLConfig configs[MAX_CONFIGS];
EGLint numConfigs, i;
EGLBoolean b;
EGLDisplay d;
EGLint screenAttribs[10];
EGLModeMESA mode[MAX_MODES];
EGLScreenMESA screen;
EGLint count, chosenMode;
EGLint width = 0, height = 0;
d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
if (!eglInitialize(d, &maj, &min)) {
printf("eglscreen: eglInitialize failed\n");
exit(1);
}
printf("eglscreen: EGL version = %d.%d\n", maj, min);
printf("eglscreen: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
/* XXX use ChooseConfig */
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
eglGetScreensMESA(d, &screen, 1, &count);
if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
printf("eglscreen: eglGetModesMESA failed!\n");
return 0;
}
/* Print list of modes, and find the one to use */
printf("eglscreen: Found %d modes:\n", count);
for (i = 0; i < count; i++) {
EGLint w, h;
eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
printf("%3d: %d x %d\n", i, w, h);
if (w > width && h > height) {
width = w;
height = h;
chosenMode = i;
}
}
printf("eglscreen: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
/* build up screenAttribs array */
i = 0;
screenAttribs[i++] = EGL_WIDTH;
screenAttribs[i++] = width;
screenAttribs[i++] = EGL_HEIGHT;
screenAttribs[i++] = height;
screenAttribs[i++] = EGL_NONE;
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
if (screen_surf == EGL_NO_SURFACE) {
printf("eglscreen: Failed to create screen surface\n");
return 0;
}
b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
if (!b) {
printf("eglscreen: Show surface failed\n");
return 0;
}
usleep(5000000);
eglDestroySurface(d, screen_surf);
eglTerminate(d);
return 0;
}

View File

@@ -1,263 +0,0 @@
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 2008 Brian Paul All Rights Reserved.
* Copyright (C) 2008 Jakob Bornecrantz All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* This program is based on eglgears and xegl_tri.
* Remixed by Jakob Bornecrantz
*
* No command line options.
* Program runs for 5 seconds then exits, outputing framerate to console
*/
#define EGL_EGLEXT_PROTOTYPES
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/gl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#define MAX_CONFIGS 10
#define MAX_MODES 100
/* XXX this probably isn't very portable */
#include <sys/time.h>
#include <unistd.h>
/* return current time (in seconds) */
static double
current_time(void)
{
struct timeval tv;
#ifdef __VMS
(void) gettimeofday(&tv, NULL );
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
#endif
return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
}
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static void draw()
{
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
static const GLfloat colors[3][3] = {
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
{
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(3, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
glPopMatrix();
}
static void init()
{
glClearColor(0.4, 0.4, 0.4, 0.0);
}
/* new window size or exposure */
static void reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
}
static void run(EGLDisplay dpy, EGLSurface surf, int ttr)
{
double st = current_time();
double ct = st;
int frames = 0;
GLfloat seconds, fps;
while (ct - st < ttr)
{
ct = current_time();
draw();
eglSwapBuffers(dpy, surf);
frames++;
}
seconds = ct - st;
fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
}
int main(int argc, char *argv[])
{
int maj, min;
EGLContext ctx;
EGLSurface screen_surf;
EGLConfig configs[MAX_CONFIGS];
EGLint numConfigs, i;
EGLBoolean b;
EGLDisplay d;
EGLint screenAttribs[10];
EGLModeMESA mode[MAX_MODES];
EGLScreenMESA screen;
EGLint count, chosenMode = 0;
GLboolean printInfo = GL_FALSE;
EGLint width = 0, height = 0;
/* parse cmd line args */
for (i = 1; i < argc; i++)
{
if (strcmp(argv[i], "-info") == 0)
{
printInfo = GL_TRUE;
}
else
printf("Warning: unknown parameter: %s\n", argv[i]);
}
/* DBR : Create EGL context/surface etc */
d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
if (!eglInitialize(d, &maj, &min)) {
printf("egltri: eglInitialize failed\n");
exit(1);
}
printf("egltri: EGL version = %d.%d\n", maj, min);
printf("egltri: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
/* XXX use ChooseConfig */
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
eglGetScreensMESA(d, &screen, 1, &count);
if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
printf("egltri: eglGetModesMESA failed!\n");
return 0;
}
/* Print list of modes, and find the one to use */
printf("egltri: Found %d modes:\n", count);
for (i = 0; i < count; i++) {
EGLint w, h;
eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
printf("%3d: %d x %d\n", i, w, h);
if (w > width && h > height) {
width = w;
height = h;
chosenMode = i;
}
}
printf("egltri: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("egltri: failed to create context\n");
return 0;
}
/* build up screenAttribs array */
i = 0;
screenAttribs[i++] = EGL_WIDTH;
screenAttribs[i++] = width;
screenAttribs[i++] = EGL_HEIGHT;
screenAttribs[i++] = height;
screenAttribs[i++] = EGL_NONE;
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
if (screen_surf == EGL_NO_SURFACE) {
printf("egltri: failed to create screen surface\n");
return 0;
}
b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
if (!b) {
printf("egltri: show surface failed\n");
return 0;
}
b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
if (!b) {
printf("egltri: make current failed\n");
return 0;
}
if (printInfo)
{
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
reshape(width, height);
glDrawBuffer( GL_BACK );
run(d, screen_surf, 5.0);
eglDestroySurface(d, screen_surf);
eglDestroyContext(d, ctx);
eglTerminate(d);
return 0;
}

View File

@@ -1,451 +0,0 @@
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* This is a port of the infamous "glxgears" demo to straight EGL
* Port by Dane Rushton 10 July 2005
*
* No command line options.
* Program runs for 5 seconds then exits, outputing framerate to console
*/
#define EGL_EGLEXT_PROTOTYPES
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/gl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#define MAX_CONFIGS 10
#define MAX_MODES 100
#define BENCHMARK
#ifdef BENCHMARK
/* XXX this probably isn't very portable */
#include <sys/time.h>
#include <unistd.h>
/* return current time (in seconds) */
static double
current_time(void)
{
struct timeval tv;
#ifdef __VMS
(void) gettimeofday(&tv, NULL );
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
#endif
return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
}
#else /*BENCHMARK*/
/* dummy */
static double
current_time(void)
{
/* update this function for other platforms! */
static double t = 0.0;
static int warn = 1;
if (warn) {
fprintf(stderr, "Warning: current_time() not implemented!!\n");
warn = 0;
}
return t += 1.0;
}
#endif /*BENCHMARK*/
#ifndef M_PI
#define M_PI 3.14159265
#endif
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
#if 0
static GLfloat eyesep = 5.0; /* Eye separation. */
static GLfloat fix_point = 40.0; /* Fixation point distance. */
static GLfloat left, right, asp; /* Stereo frustum params. */
#endif
/*
*
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* Input: inner_radius - radius of hole at center
* outer_radius - radius at center of teeth
* width - width of gear
* teeth - number of teeth
* tooth_depth - depth of tooth
*/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
r2 = outer_radius + tooth_depth / 2.0;
da = 2.0 * M_PI / teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
if (i < teeth) {
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
if (i < teeth) {
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
-width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
u = r2 * cos(angle + da) - r1 * cos(angle);
v = r2 * sin(angle + da) - r1 * sin(angle);
len = sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
-width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
}
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
glEnd();
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
init(void)
{
static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
}
static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
{
double st = current_time();
double ct = st;
int frames = 0;
GLfloat seconds, fps;
while (ct - st < ttr)
{
double tt = current_time();
double dt = tt - ct;
ct = tt;
/* advance rotation for next frame */
angle += 70.0 * dt; /* 70 degrees per second */
if (angle > 3600.0)
angle -= 3600.0;
draw();
eglSwapBuffers(dpy, surf);
frames++;
}
seconds = ct - st;
fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
}
int
main(int argc, char *argv[])
{
int major, minor;
EGLContext ctx;
EGLSurface surface;
EGLConfig configs[MAX_CONFIGS];
EGLint numConfigs, i;
EGLBoolean b;
EGLDisplay d;
EGLint screenAttribs[10];
GLboolean printInfo = GL_FALSE;
EGLint width = 300, height = 300;
/* parse cmd line args */
for (i = 1; i < argc; i++)
{
if (strcmp(argv[i], "-info") == 0)
{
printInfo = GL_TRUE;
}
else
printf("Warning: unknown parameter: %s\n", argv[i]);
}
/* DBR : Create EGL context/surface etc */
d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
if (!eglInitialize(d, &major, &minor)) {
printf("peglgears: eglInitialize failed\n");
return 0;
}
printf("peglgears: EGL version = %d.%d\n", major, minor);
printf("peglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("peglgears: failed to create context\n");
return 0;
}
/* build up screenAttribs array */
i = 0;
screenAttribs[i++] = EGL_WIDTH;
screenAttribs[i++] = width;
screenAttribs[i++] = EGL_HEIGHT;
screenAttribs[i++] = height;
screenAttribs[i++] = EGL_NONE;
surface = eglCreatePbufferSurface(d, configs[0], screenAttribs);
if (surface == EGL_NO_SURFACE) {
printf("peglgears: failed to create pbuffer surface\n");
return 0;
}
b = eglMakeCurrent(d, surface, surface, ctx);
if (!b) {
printf("peglgears: make current failed\n");
return 0;
}
if (printInfo)
{
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
reshape(width, height);
glDrawBuffer( GL_BACK );
run_gears(d, surface, 5.0);
eglDestroySurface(d, surface);
eglDestroyContext(d, ctx);
eglTerminate(d);
return 0;
}

View File

@@ -1,359 +0,0 @@
/*
* Copyright (C) 2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Draw a triangle with X/EGL.
* Brian Paul
* 3 June 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GL/gl.h> /* using full OpenGL for now */
#include <GLES/egl.h>
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static void
draw(void)
{
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
static const GLfloat colors[3][3] = {
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
{
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(3, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
}
static void
init(void)
{
glClearColor(0.4, 0.4, 0.4, 0.0);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, 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;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"xegl_tri", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

View File

@@ -1,474 +0,0 @@
/*
* Simple demo for eglBindTexImage. Based on xegl_tri.c by
*
* Copyright (C) 2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* The spec says that eglBindTexImage supports only OpenGL ES context, but this
* demo uses OpenGL context. Keep in mind that this is non-standard.
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GL/gl.h>
#include <EGL/egl.h>
static EGLDisplay dpy;
static EGLContext ctx_win, ctx_pbuf;
static EGLSurface surf_win, surf_pbuf;
static GLuint tex_pbuf;
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static GLboolean blend = GL_TRUE;
static GLuint color_flow;
static void
make_pbuffer(int width, int height)
{
static const EGLint config_attribs[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE,
EGL_NONE
};
EGLint pbuf_attribs[] = {
EGL_WIDTH, width,
EGL_HEIGHT, height,
EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB,
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
EGL_NONE
};
EGLConfig config;
EGLint num_configs;
if (!eglChooseConfig(dpy, config_attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config for pbuffer\n");
exit(1);
}
eglBindAPI(EGL_OPENGL_API);
ctx_pbuf = eglCreateContext(dpy, config, EGL_NO_CONTEXT, NULL );
surf_pbuf = eglCreatePbufferSurface(dpy, config, pbuf_attribs);
if (surf_pbuf == EGL_NO_SURFACE) {
printf("failed to allocate pbuffer\n");
exit(1);
}
glGenTextures(1, &tex_pbuf);
}
static void
use_pbuffer(void)
{
static int initialized;
eglMakeCurrent(dpy, surf_pbuf, surf_pbuf, ctx_pbuf);
if (!initialized) {
EGLint width, height;
GLfloat ar;
initialized = 1;
eglQuerySurface(dpy, surf_pbuf, EGL_WIDTH, &width);
eglQuerySurface(dpy, surf_pbuf, EGL_WIDTH, &height);
ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1, 1, 1.0, 10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* y-inverted */
glScalef(1.0, -1.0, 1.0);
glTranslatef(0.0, 0.0, -5.0);
glClearColor(0.2, 0.2, 0.2, 0.0);
}
}
static void
make_window(Display *x_dpy, const char *name,
int x, int y, int width, int height,
Window *winRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 8,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLConfig config;
EGLint num_configs, vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig(dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
if (!eglGetConfigAttrib(dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
attr.override_redirect = 0;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_API);
ctx_win = eglCreateContext(dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx_win) {
printf("Error: glXCreateContext failed\n");
exit(1);
}
surf_win = eglCreateWindowSurface(dpy, config, win, NULL);
XFree(visInfo);
*winRet = win;
}
static void
use_window(void)
{
static int initialized;
eglMakeCurrent(dpy, surf_win, surf_win, ctx_win);
if (!initialized) {
initialized = 1;
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex_pbuf);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
static void
draw_triangle(void)
{
static const GLfloat verts[3][2] = {
{ -3, -3 },
{ 3, -3 },
{ 0, 3 }
};
GLfloat colors[3][3] = {
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
};
GLint i;
/* flow the color */
for (i = 0; i < 3; i++) {
GLint first = (i + color_flow / 256) % 3;
GLint second = (first + 1) % 3;
GLint third = (second + 1) % 3;
GLfloat c = (color_flow % 256) / 256.0f;
c = c * c * c;
colors[i][first] = 1.0f - c;
colors[i][second] = c;
colors[i][third] = 0.0f;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(3, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
static void
draw_textured_cube(void)
{
static const GLfloat verts[][2] = {
{ -4, -4 },
{ 4, -4 },
{ 4, 4 },
{ -4, 4 }
};
static const GLfloat colors[][4] = {
{ 1, 1, 1, 0.5 },
{ 1, 1, 1, 0.5 },
{ 1, 1, 1, 0.5 },
{ 1, 1, 1, 0.5 }
};
static const GLfloat texs[][2] = {
{ 0, 0 },
{ 1, 0 },
{ 1, 1 },
{ 0, 1 }
};
static const GLfloat xforms[6][4] = {
{ 0, 0, 1, 0 },
{ 90, 0, 1, 0 },
{ 180, 0, 1, 0 },
{ 270, 0, 1, 0 },
{ 90, 1, 0, 0 },
{ -90, 1, 0, 0 }
};
GLint i;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (blend) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
} else {
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
}
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
glTexCoordPointer(2, GL_FLOAT, 0, texs);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
for (i = 0; i < 6; i++) {
glPushMatrix();
glRotatef(xforms[i][0], xforms[i][1], xforms[i][2], xforms[i][3]);
glTranslatef(0, 0, 4.1);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glPopMatrix();
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
static void
draw(void)
{
use_pbuffer();
draw_triangle();
use_window();
eglBindTexImage(dpy, surf_pbuf, EGL_BACK_BUFFER);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
draw_textured_cube();
glPopMatrix();
eglReleaseTexImage(dpy, surf_pbuf, EGL_BACK_BUFFER);
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
use_window();
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
event_loop(Display *x_dpy, Window win)
{
while (1) {
int redraw = 1;
if (XPending(x_dpy) > 0) {
XEvent event;
XNextEvent(x_dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, 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 if (code == XK_b) {
blend = !blend;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (redraw) {
view_rotx += 1.0;
view_roty += 2.0;
view_rotz += 1.5;
color_flow += 20;
draw();
eglSwapBuffers(dpy, surf_win);
}
}
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
char *dpyName = NULL;
EGLint egl_major, egl_minor;
const char *s;
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
dpy = eglGetDisplay(x_dpy);
if (!dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
make_window(x_dpy, "color flow", 0, 0, winWidth, winHeight, &win);
make_pbuffer(winWidth, winHeight);
XMapWindow(x_dpy, win);
reshape(winWidth, winHeight);
event_loop(x_dpy, win);
glDeleteTextures(1, &tex_pbuf);
eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglTerminate(dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

View File

@@ -1,787 +0,0 @@
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Ported to X/EGL/GLES. XXX Actually, uses full OpenGL ATM.
* Brian Paul
* 30 May 2008
*/
/*
* Command line options:
* -info print GL implementation information
*
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GL/gl.h>
#include <EGL/egl.h>
#define BENCHMARK
#ifdef BENCHMARK
/* XXX this probably isn't very portable */
#include <sys/time.h>
#include <unistd.h>
/* return current time (in seconds) */
static double
current_time(void)
{
struct timeval tv;
#ifdef __VMS
(void) gettimeofday(&tv, NULL );
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
#endif
return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
}
#else /*BENCHMARK*/
/* dummy */
static double
current_time(void)
{
/* update this function for other platforms! */
static double t = 0.0;
static int warn = 1;
if (warn) {
fprintf(stderr, "Warning: current_time() not implemented!!\n");
warn = 0;
}
return t += 1.0;
}
#endif /*BENCHMARK*/
#ifndef M_PI
#define M_PI 3.14159265
#endif
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
/*
*
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* Input: inner_radius - radius of hole at center
* outer_radius - radius at center of teeth
* width - width of gear
* teeth - number of teeth
* tooth_depth - depth of tooth
*/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
r2 = outer_radius + tooth_depth / 2.0;
da = 2.0 * M_PI / teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
if (i < teeth) {
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
if (i < teeth) {
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
-width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
u = r2 * cos(angle + da) - r1 * cos(angle);
v = r2 * sin(angle + da) - r1 * sin(angle);
len = sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
-width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
}
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
glEnd();
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
init(void)
{
static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
glClearColor(0.2, 0.2, 0.2, 0.0);
}
struct egl_manager {
EGLNativeDisplayType xdpy;
EGLNativeWindowType xwin;
EGLNativePixmapType xpix;
EGLDisplay dpy;
EGLConfig conf;
EGLContext ctx;
EGLSurface win;
EGLSurface pix;
EGLSurface pbuf;
EGLBoolean verbose;
EGLint major, minor;
};
static struct egl_manager *
egl_manager_new(EGLNativeDisplayType xdpy, const EGLint *attrib_list,
EGLBoolean verbose)
{
struct egl_manager *eman;
const char *ver;
EGLint num_conf;
eman = calloc(1, sizeof(*eman));
if (!eman)
return NULL;
eman->verbose = verbose;
eman->xdpy = xdpy;
eman->dpy = eglGetDisplay(eman->xdpy);
if (eman->dpy == EGL_NO_DISPLAY) {
printf("eglGetDisplay() failed\n");
free(eman);
return NULL;
}
if (!eglInitialize(eman->dpy, &eman->major, &eman->minor)) {
printf("eglInitialize() failed\n");
free(eman);
return NULL;
}
ver = eglQueryString(eman->dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", ver);
if (!eglChooseConfig(eman->dpy, attrib_list, &eman->conf, 1, &num_conf) ||
!num_conf) {
printf("eglChooseConfig() failed\n");
eglTerminate(eman->dpy);
free(eman);
return NULL;
}
eman->ctx = eglCreateContext(eman->dpy, eman->conf, EGL_NO_CONTEXT, NULL);
if (eman->ctx == EGL_NO_CONTEXT) {
printf("eglCreateContext() failed\n");
eglTerminate(eman->dpy);
free(eman);
return NULL;
}
return eman;
}
static EGLBoolean
egl_manager_create_window(struct egl_manager *eman, const char *name,
EGLint w, EGLint h, EGLBoolean need_surface,
EGLBoolean fullscreen, const EGLint *attrib_list)
{
XVisualInfo vinfo_template, *vinfo = NULL;
EGLint val, num_vinfo;
Window root;
XSetWindowAttributes attrs;
unsigned long mask;
EGLint x = 0, y = 0;
if (!eglGetConfigAttrib(eman->dpy, eman->conf,
EGL_NATIVE_VISUAL_ID, &val)) {
printf("eglGetConfigAttrib() failed\n");
return EGL_FALSE;
}
if (val) {
vinfo_template.visualid = (VisualID) val;
vinfo = XGetVisualInfo(eman->xdpy, VisualIDMask, &vinfo_template, &num_vinfo);
}
/* try harder if window surface is not needed */
if (!vinfo && !need_surface &&
eglGetConfigAttrib(eman->dpy, eman->conf, EGL_BUFFER_SIZE, &val)) {
if (val == 32)
val = 24;
vinfo_template.depth = val;
vinfo = XGetVisualInfo(eman->xdpy, VisualDepthMask, &vinfo_template, &num_vinfo);
}
if (!vinfo) {
printf("XGetVisualInfo() failed\n");
return EGL_FALSE;
}
root = DefaultRootWindow(eman->xdpy);
if (fullscreen) {
x = y = 0;
w = DisplayWidth(eman->xdpy, DefaultScreen(eman->xdpy));
h = DisplayHeight(eman->xdpy, DefaultScreen(eman->xdpy));
}
/* window attributes */
attrs.background_pixel = 0;
attrs.border_pixel = 0;
attrs.colormap = XCreateColormap(eman->xdpy, root, vinfo->visual, AllocNone);
attrs.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
attrs.override_redirect = fullscreen;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
eman->xwin = XCreateWindow(eman->xdpy, root, x, y, w, h,
0, vinfo->depth, InputOutput,
vinfo->visual, mask, &attrs);
XFree(vinfo);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = w;
sizehints.height = h;
sizehints.flags = USSize | USPosition;
XSetNormalHints(eman->xdpy, eman->xwin, &sizehints);
XSetStandardProperties(eman->xdpy, eman->xwin, name, name,
None, (char **)NULL, 0, &sizehints);
}
if (need_surface) {
eman->win = eglCreateWindowSurface(eman->dpy, eman->conf,
eman->xwin, attrib_list);
if (eman->win == EGL_NO_SURFACE) {
printf("eglCreateWindowSurface() failed\n");
XDestroyWindow(eman->xdpy, eman->xwin);
eman->xwin = None;
return EGL_FALSE;
}
}
XMapWindow(eman->xdpy, eman->xwin);
return EGL_TRUE;
}
static EGLBoolean
egl_manager_create_pixmap(struct egl_manager *eman, EGLNativeWindowType xwin,
EGLBoolean need_surface, const EGLint *attrib_list)
{
XWindowAttributes attrs;
if (!XGetWindowAttributes(eman->xdpy, xwin, &attrs)) {
printf("XGetWindowAttributes() failed\n");
return EGL_FALSE;
}
eman->xpix = XCreatePixmap(eman->xdpy, xwin,
attrs.width, attrs.height, attrs.depth);
if (need_surface) {
eman->pix = eglCreatePixmapSurface(eman->dpy, eman->conf,
eman->xpix, attrib_list);
if (eman->pix == EGL_NO_SURFACE) {
printf("eglCreatePixmapSurface() failed\n");
XFreePixmap(eman->xdpy, eman->xpix);
eman->xpix = None;
return EGL_FALSE;
}
}
return EGL_TRUE;
}
static EGLBoolean
egl_manager_create_pbuffer(struct egl_manager *eman, const EGLint *attrib_list)
{
eman->pbuf = eglCreatePbufferSurface(eman->dpy, eman->conf, attrib_list);
if (eman->pbuf == EGL_NO_SURFACE) {
printf("eglCreatePbufferSurface() failed\n");
return EGL_FALSE;
}
return EGL_TRUE;
}
static void
egl_manager_destroy(struct egl_manager *eman)
{
eglMakeCurrent(eman->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglTerminate(eman->dpy);
if (eman->xwin != None)
XDestroyWindow(eman->xdpy, eman->xwin);
if (eman->xpix != None)
XFreePixmap(eman->xdpy, eman->xpix);
free(eman);
}
static void
event_loop(struct egl_manager *eman, EGLint surface_type, EGLint w, EGLint h)
{
GC gc = XCreateGC(eman->xdpy, eman->xwin, 0, NULL);
EGLint orig_w = w, orig_h = h;
if (surface_type == EGL_PBUFFER_BIT)
printf("there will be no screen update if "
"eglCopyBuffers() is not implemented\n");
while (1) {
while (XPending(eman->xdpy) > 0) {
XEvent event;
XNextEvent(eman->xdpy, &event);
switch (event.type) {
case Expose:
/* we'll redraw below */
break;
case ConfigureNotify:
w = event.xconfigure.width;
h = event.xconfigure.height;
if (surface_type == EGL_WINDOW_BIT)
reshape(w, h);
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;
}
}
}
}
}
{
static int frames = 0;
static double tRot0 = -1.0, tRate0 = -1.0;
double dt, t = current_time();
int x, y;
if (tRot0 < 0.0)
tRot0 = t;
dt = t - tRot0;
tRot0 = t;
/* advance rotation for next frame */
angle += 70.0 * dt; /* 70 degrees per second */
if (angle > 3600.0)
angle -= 3600.0;
draw();
switch (surface_type) {
case EGL_WINDOW_BIT:
eglSwapBuffers(eman->dpy, eman->win);
break;
case EGL_PBUFFER_BIT:
eglWaitClient();
if (!eglCopyBuffers(eman->xdpy, eman->pbuf, eman->xpix))
break;
/* fall through */
case EGL_PIXMAP_BIT:
eglWaitClient();
for (x = 0; x < w; x += orig_w) {
for (y = 0; y < h; y += orig_h) {
XCopyArea(eman->xdpy, eman->xpix, eman->xwin, gc,
0, 0, orig_w, orig_h, x, y);
}
}
break;
}
frames++;
if (tRate0 < 0.0)
tRate0 = t;
if (t - tRate0 >= 5.0) {
GLfloat seconds = t - tRate0;
GLfloat fps = frames / seconds;
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
fps);
tRate0 = t;
frames = 0;
}
}
}
XFreeGC(eman->xdpy, gc);
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -fullscreen run in fullscreen mode\n");
printf(" -info display OpenGL renderer info\n");
printf(" -pixmap use pixmap surface\n");
printf(" -pbuffer use pbuffer surface\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
char *dpyName = NULL;
struct egl_manager *eman;
EGLint attribs[] = {
EGL_SURFACE_TYPE, 0, /* filled later */
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE
};
char win_title[] = "xeglgears (window/pixmap/pbuffer)";
EGLint surface_type = EGL_WINDOW_BIT;
GLboolean printInfo = GL_FALSE;
GLboolean fullscreen = GL_FALSE;
EGLBoolean ret;
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else if (strcmp(argv[i], "-fullscreen") == 0) {
fullscreen = GL_TRUE;
}
else if (strcmp(argv[i], "-pixmap") == 0) {
surface_type = EGL_PIXMAP_BIT;
}
else if (strcmp(argv[i], "-pbuffer") == 0) {
surface_type = EGL_PBUFFER_BIT;
}
else {
usage();
return -1;
}
}
/* set surface type */
attribs[1] = surface_type;
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
eglBindAPI(EGL_OPENGL_API);
eman = egl_manager_new(x_dpy, attribs, printInfo);
if (!eman) {
XCloseDisplay(x_dpy);
return -1;
}
snprintf(win_title, sizeof(win_title), "xeglgears (%s)",
(surface_type == EGL_WINDOW_BIT) ? "window" :
(surface_type == EGL_PIXMAP_BIT) ? "pixmap" : "pbuffer");
/* create surface(s) */
switch (surface_type) {
case EGL_WINDOW_BIT:
ret = egl_manager_create_window(eman, win_title, winWidth, winHeight,
EGL_TRUE, fullscreen, NULL);
if (ret)
ret = eglMakeCurrent(eman->dpy, eman->win, eman->win, eman->ctx);
break;
case EGL_PIXMAP_BIT:
ret = (egl_manager_create_window(eman, win_title, winWidth, winHeight,
EGL_FALSE, fullscreen, NULL) &&
egl_manager_create_pixmap(eman, eman->xwin,
EGL_TRUE, NULL));
if (ret)
ret = eglMakeCurrent(eman->dpy, eman->pix, eman->pix, eman->ctx);
break;
case EGL_PBUFFER_BIT:
{
EGLint pbuf_attribs[] = {
EGL_WIDTH, winWidth,
EGL_HEIGHT, winHeight,
EGL_NONE
};
ret = (egl_manager_create_window(eman, win_title, winWidth, winHeight,
EGL_FALSE, fullscreen, NULL) &&
egl_manager_create_pixmap(eman, eman->xwin,
EGL_FALSE, NULL) &&
egl_manager_create_pbuffer(eman, pbuf_attribs));
if (ret)
ret = eglMakeCurrent(eman->dpy, eman->pbuf, eman->pbuf, eman->ctx);
}
break;
default:
ret = EGL_FALSE;
break;
}
if (!ret) {
egl_manager_destroy(eman);
XCloseDisplay(x_dpy);
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(eman, surface_type, winWidth, winHeight);
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
glDeleteLists(gear3, 1);
egl_manager_destroy(eman);
XCloseDisplay(x_dpy);
return 0;
}

View File

@@ -1,773 +0,0 @@
/*
* Copyright (C) 2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Ported to EGL by Chia-I Wu <olvaffe@gmail.com>
*/
/*
* This program tests EGL thread safety.
* Command line options:
* -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 $DISPLAY)
* -t Use texture mapping
*
* Brian Paul 20 July 2000
*/
/*
* Notes:
* - Each thread gets its own EGL context.
*
* - The EGL contexts share texture objects.
*
* - When 't' is pressed to update the texture image, the window/thread which
* has input focus is signalled to change the texture. The other threads
* should see the updated texture the next time they call glBindTexture.
*/
#if defined(PTHREADS) /* defined by Mesa on Linux and other platforms */
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/gl.h>
#include <EGL/egl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
/*
* Each window/thread/context:
*/
struct winthread {
Display *Dpy;
int Index;
pthread_t Thread;
Window Win;
EGLDisplay Display;
EGLContext Context;
EGLSurface Surface;
float Angle;
int WinWidth, WinHeight;
GLboolean NewSize;
GLboolean Initialized;
GLboolean MakeNewTexture;
};
#define MAX_WINTHREADS 100
static struct winthread WinThreads[MAX_WINTHREADS];
static int NumWinThreads = 0;
static volatile GLboolean ExitFlag = GL_FALSE;
static GLboolean MultiDisplays = 0;
static GLboolean Locking = 0;
static GLboolean Texture = GL_FALSE;
static GLuint TexObj = 12;
static GLboolean Animate = GL_TRUE;
static pthread_mutex_t Mutex;
static pthread_cond_t CondVar;
static pthread_mutex_t CondMutex;
static void
Error(const char *msg)
{
fprintf(stderr, "Error: %s\n", msg);
exit(1);
}
static void
signal_redraw(void)
{
pthread_mutex_lock(&CondMutex);
pthread_cond_broadcast(&CondVar);
pthread_mutex_unlock(&CondMutex);
}
static void
MakeNewTexture(struct winthread *wt)
{
#define TEX_SIZE 128
static float step = 0.0;
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 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;
}
}
step += 0.5;
glBindTexture(GL_TEXTURE_2D, TexObj);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
if (width) {
assert(width == TEX_SIZE);
/* sub-tex replace */
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TEX_SIZE, TEX_SIZE,
GL_RGBA, GL_FLOAT, image);
}
else {
/* create new */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TEX_SIZE, TEX_SIZE, 0,
GL_RGBA, GL_FLOAT, image);
}
}
/* draw a colored cube */
static void
draw_object(void)
{
glPushMatrix();
glScalef(0.75, 0.75, 0.75);
glColor3f(1, 0, 0);
if (Texture) {
glBindTexture(GL_TEXTURE_2D, TexObj);
glEnable(GL_TEXTURE_2D);
}
else {
glDisable(GL_TEXTURE_2D);
}
glBegin(GL_QUADS);
/* -X */
glColor3f(0, 1, 1);
glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
glTexCoord2f(1, 0); glVertex3f(-1, 1, -1);
glTexCoord2f(1, 1); glVertex3f(-1, 1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, -1, 1);
/* +X */
glColor3f(1, 0, 0);
glTexCoord2f(0, 0); glVertex3f(1, -1, -1);
glTexCoord2f(1, 0); glVertex3f(1, 1, -1);
glTexCoord2f(1, 1); glVertex3f(1, 1, 1);
glTexCoord2f(0, 1); glVertex3f(1, -1, 1);
/* -Y */
glColor3f(1, 0, 1);
glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
glTexCoord2f(1, 0); glVertex3f( 1, -1, -1);
glTexCoord2f(1, 1); glVertex3f( 1, -1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, -1, 1);
/* +Y */
glColor3f(0, 1, 0);
glTexCoord2f(0, 0); glVertex3f(-1, 1, -1);
glTexCoord2f(1, 0); glVertex3f( 1, 1, -1);
glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, 1, 1);
/* -Z */
glColor3f(1, 1, 0);
glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
glTexCoord2f(1, 0); glVertex3f( 1, -1, -1);
glTexCoord2f(1, 1); glVertex3f( 1, 1, -1);
glTexCoord2f(0, 1); glVertex3f(-1, 1, -1);
/* +Y */
glColor3f(0, 0, 1);
glTexCoord2f(0, 0); glVertex3f(-1, -1, 1);
glTexCoord2f(1, 0); glVertex3f( 1, -1, 1);
glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, 1, 1);
glEnd();
glPopMatrix();
}
/* signal resize of given window */
static void
resize(struct winthread *wt, int w, int h)
{
wt->NewSize = GL_TRUE;
wt->WinWidth = w;
wt->WinHeight = h;
if (!Animate)
signal_redraw();
}
/*
* We have an instance of this for each thread.
*/
static void
draw_loop(struct winthread *wt)
{
while (!ExitFlag) {
if (Locking)
pthread_mutex_lock(&Mutex);
if (!wt->Initialized) {
eglMakeCurrent(wt->Display, wt->Surface, wt->Surface, wt->Context);
printf("xeglthreads: %d: GL_RENDERER = %s\n", wt->Index,
(char *) glGetString(GL_RENDERER));
if (Texture /*&& wt->Index == 0*/) {
MakeNewTexture(wt);
}
wt->Initialized = GL_TRUE;
}
if (Locking)
pthread_mutex_unlock(&Mutex);
eglBindAPI(EGL_OPENGL_API);
if (eglGetCurrentContext() != wt->Context) {
printf("xeglthreads: current context %p != %p\n",
eglGetCurrentContext(), wt->Context);
}
glEnable(GL_DEPTH_TEST);
if (wt->NewSize) {
GLfloat w = (float) wt->WinWidth / (float) wt->WinHeight;
glViewport(0, 0, wt->WinWidth, wt->WinHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-w, w, -1.0, 1.0, 1.5, 10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -2.5);
wt->NewSize = GL_FALSE;
}
if (wt->MakeNewTexture) {
MakeNewTexture(wt);
wt->MakeNewTexture = GL_FALSE;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(wt->Angle, 0, 1, 0);
glRotatef(wt->Angle, 1, 0, 0);
glScalef(0.7, 0.7, 0.7);
draw_object();
glPopMatrix();
if (Locking)
pthread_mutex_lock(&Mutex);
eglSwapBuffers(wt->Display, wt->Surface);
if (Locking)
pthread_mutex_unlock(&Mutex);
if (Animate) {
usleep(5000);
}
else {
/* wait for signal to draw */
pthread_mutex_lock(&CondMutex);
pthread_cond_wait(&CondVar, &CondMutex);
pthread_mutex_unlock(&CondMutex);
}
wt->Angle += 1.0;
}
eglMakeCurrent(wt->Display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
static void
keypress(XEvent *event, struct winthread *wt)
{
char buf[100];
KeySym keySym;
XComposeStatus stat;
XLookupString(&event->xkey, buf, sizeof(buf), &keySym, &stat);
switch (keySym) {
case XK_Escape:
/* tell all threads to exit */
if (!Animate) {
signal_redraw();
}
ExitFlag = GL_TRUE;
/*printf("exit draw_loop %d\n", wt->Index);*/
return;
case XK_t:
case XK_T:
if (Texture) {
wt->MakeNewTexture = GL_TRUE;
if (!Animate)
signal_redraw();
}
break;
case XK_a:
case XK_A:
Animate = !Animate;
if (Animate) /* yes, prev Animate state! */
signal_redraw();
break;
case XK_s:
case XK_S:
if (!Animate)
signal_redraw();
break;
default:
; /* nop */
}
}
/*
* The main process thread runs this loop.
* Single display connection for all threads.
*/
static void
event_loop(Display *dpy)
{
XEvent event;
int i;
assert(!MultiDisplays);
while (!ExitFlag) {
if (Locking) {
while (1) {
int k;
pthread_mutex_lock(&Mutex);
k = XPending(dpy);
if (k) {
XNextEvent(dpy, &event);
pthread_mutex_unlock(&Mutex);
break;
}
pthread_mutex_unlock(&Mutex);
usleep(5000);
}
}
else {
XNextEvent(dpy, &event);
}
switch (event.type) {
case ConfigureNotify:
/* Find winthread for this event's window */
for (i = 0; i < NumWinThreads; i++) {
struct winthread *wt = &WinThreads[i];
if (event.xconfigure.window == wt->Win) {
resize(wt, event.xconfigure.width,
event.xconfigure.height);
break;
}
}
break;
case KeyPress:
for (i = 0; i < NumWinThreads; i++) {
struct winthread *wt = &WinThreads[i];
if (event.xkey.window == wt->Win) {
keypress(&event, wt);
break;
}
}
break;
default:
/*no-op*/ ;
}
}
}
/*
* Separate display connection for each thread.
*/
static void
event_loop_multi(void)
{
XEvent event;
int w = 0;
assert(MultiDisplays);
while (!ExitFlag) {
struct winthread *wt = &WinThreads[w];
if (XPending(wt->Dpy)) {
XNextEvent(wt->Dpy, &event);
switch (event.type) {
case ConfigureNotify:
resize(wt, event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
keypress(&event, wt);
break;
default:
; /* nop */
}
}
w = (w + 1) % NumWinThreads;
usleep(5000);
}
}
/*
* we'll call this once for each thread, before the threads are created.
*/
static void
create_window(struct winthread *wt, EGLContext shareCtx)
{
Window win;
EGLContext ctx;
EGLSurface surf;
EGLint attribs[] = { EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE };
EGLConfig config;
EGLint num_configs;
EGLint vid;
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
XVisualInfo *visinfo, visTemplate;
int num_visuals;
int width = 160, height = 160;
int xpos = (wt->Index % 8) * (width + 10);
int ypos = (wt->Index / 8) * (width + 20);
scrnum = DefaultScreen(wt->Dpy);
root = RootWindow(wt->Dpy, scrnum);
if (!eglChooseConfig(wt->Display, attribs, &config, 1, &num_configs)) {
Error("Unable to choose an EGL config");
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(wt->Display, config, EGL_NATIVE_VISUAL_ID, &vid)) {
Error("Unable to get visual id of EGL config\n");
}
visTemplate.visualid = vid;
visinfo = XGetVisualInfo(wt->Dpy, VisualIDMask,
&visTemplate, &num_visuals);
if (!visinfo) {
Error("Unable to find RGB, Z, double-buffered visual");
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap(wt->Dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow(wt->Dpy, root, xpos, ypos, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr);
if (!win) {
Error("Couldn't create window");
}
XFree(visinfo);
{
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(wt->Dpy, win, &sizehints);
XSetStandardProperties(wt->Dpy, win, "xeglthreads", "xeglthreads",
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(wt->Display, config, shareCtx, NULL);
if (!ctx) {
Error("Couldn't create EGL context");
}
surf = eglCreateWindowSurface(wt->Display, config, win, NULL);
if (!surf) {
Error("Couldn't create EGL surface");
}
XMapWindow(wt->Dpy, win);
XSync(wt->Dpy, 0);
/* save the info for this window/context */
wt->Win = win;
wt->Context = ctx;
wt->Surface = surf;
wt->Angle = 0.0;
wt->WinWidth = width;
wt->WinHeight = height;
wt->NewSize = GL_TRUE;
}
/*
* Called by pthread_create()
*/
static void *
thread_function(void *p)
{
struct winthread *wt = (struct winthread *) p;
draw_loop(wt);
return NULL;
}
/*
* called before exit to wait for all threads to finish
*/
static void
clean_up(void)
{
int i;
/* wait for threads to finish */
for (i = 0; i < NumWinThreads; i++) {
pthread_join(WinThreads[i].Thread, NULL);
}
for (i = 0; i < NumWinThreads; i++) {
eglDestroyContext(WinThreads[i].Display, WinThreads[i].Context);
XDestroyWindow(WinThreads[i].Dpy, WinThreads[i].Win);
}
}
static void
usage(void)
{
printf("xeglthreads: test of EGL/GL thread safety (any key = exit)\n");
printf("Usage:\n");
printf(" xeglthreads [options]\n");
printf("Options:\n");
printf(" -display DISPLAYNAME Specify display string\n");
printf(" -n NUMTHREADS Number of threads to create\n");
printf(" -p Use a separate display connection for each thread\n");
printf(" -l Use application-side locking\n");
printf(" -t Enable texturing\n");
printf("Keyboard:\n");
printf(" Esc Exit\n");
printf(" t Change texture image (requires -t option)\n");
printf(" a Toggle animation\n");
printf(" s Step rotation (when not animating)\n");
}
int
main(int argc, char *argv[])
{
char *displayName = NULL;
int numThreads = 2;
Display *dpy = NULL;
EGLDisplay *egl_dpy = NULL;
int i;
Status threadStat;
if (argc == 1) {
usage();
}
else {
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) {
displayName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-p") == 0) {
MultiDisplays = 1;
}
else if (strcmp(argv[i], "-l") == 0) {
Locking = 1;
}
else if (strcmp(argv[i], "-t") == 0) {
Texture = 1;
}
else if (strcmp(argv[i], "-n") == 0 && i + 1 < argc) {
numThreads = atoi(argv[i + 1]);
if (numThreads < 1)
numThreads = 1;
else if (numThreads > MAX_WINTHREADS)
numThreads = MAX_WINTHREADS;
i++;
}
else {
usage();
exit(1);
}
}
}
if (Locking)
printf("xeglthreads: Using explicit locks around Xlib calls.\n");
else
printf("xeglthreads: No explict locking.\n");
if (MultiDisplays)
printf("xeglthreads: Per-thread display connections.\n");
else
printf("xeglthreads: Single display connection.\n");
/*
* VERY IMPORTANT: call XInitThreads() before any other Xlib functions.
*/
if (!MultiDisplays) {
if (!Locking) {
threadStat = XInitThreads();
if (threadStat) {
printf("XInitThreads() returned %d (success)\n",
(int) threadStat);
}
else {
printf("XInitThreads() returned 0 "
"(failure- this program may fail)\n");
}
}
dpy = XOpenDisplay(displayName);
if (!dpy) {
fprintf(stderr, "Unable to open display %s\n",
XDisplayName(displayName));
return -1;
}
egl_dpy = eglGetDisplay(dpy);
if (!egl_dpy) {
fprintf(stderr, "Unable to get EGL display\n");
XCloseDisplay(dpy);
return -1;
}
if (!eglInitialize(egl_dpy, NULL, NULL)) {
fprintf(stderr, "Unable to initialize EGL display\n");
return -1;
}
}
pthread_mutex_init(&Mutex, NULL);
pthread_mutex_init(&CondMutex, NULL);
pthread_cond_init(&CondVar, NULL);
printf("xeglthreads: creating windows\n");
NumWinThreads = numThreads;
/* Create the EGL windows and contexts */
for (i = 0; i < numThreads; i++) {
EGLContext share;
if (MultiDisplays) {
WinThreads[i].Dpy = XOpenDisplay(displayName);
assert(WinThreads[i].Dpy);
WinThreads[i].Display = eglGetDisplay(WinThreads[i].Dpy);
assert(eglInitialize(WinThreads[i].Display, NULL, NULL));
}
else {
WinThreads[i].Dpy = dpy;
WinThreads[i].Display = egl_dpy;
}
WinThreads[i].Index = i;
WinThreads[i].Initialized = GL_FALSE;
share = (Texture && i > 0) ? WinThreads[0].Context : 0;
create_window(&WinThreads[i], share);
}
printf("xeglthreads: creating threads\n");
/* Create the threads */
for (i = 0; i < numThreads; i++) {
pthread_create(&WinThreads[i].Thread, NULL, thread_function,
(void*) &WinThreads[i]);
printf("xeglthreads: Created thread %p\n",
(void *) WinThreads[i].Thread);
}
if (MultiDisplays)
event_loop_multi();
else
event_loop(dpy);
clean_up();
if (MultiDisplays) {
for (i = 0; i < numThreads; i++) {
eglTerminate(WinThreads[i].Display);
XCloseDisplay(WinThreads[i].Dpy);
}
}
else {
eglTerminate(egl_dpy);
XCloseDisplay(dpy);
}
return 0;
}
#else /* PTHREADS */
#include <stdio.h>
int
main(int argc, char *argv[])
{
printf("Sorry, this program wasn't compiled with PTHREADS defined.\n");
return 0;
}
#endif /* PTHREADS */

View File

@@ -1,6 +0,0 @@
!!ARBfp1.0
TEMP R0;
MOV R0, fragment.color;
ADD_SAT R0, R0, R0;
MUL result.color, {0.5}.x, R0;
END

View File

@@ -1,6 +0,0 @@
!!ARBfp1.0
TEMP R0;
MOV R0, fragment.color;
MOV R0, R0.zyxw;
MOV result.color, R0;
END

View File

@@ -1,6 +0,0 @@
!!ARBfp1.0
TEMP R0;
MOV R0, fragment.color;
MUL R0, R0.zyxw, fragment.color;
MOV result.color, R0;
END

View File

@@ -182,7 +182,7 @@ static void fillConvolution(GLint *k,
static void setupConvolution()
{
GLint *kernel = (GLint*)malloc(sizeof(GLint) * 9);
GLfloat scale;
GLfloat scale = 0.0;
GLfloat *vecKer = (GLfloat*)malloc(sizeof(GLfloat) * 9 * 4);
GLuint loc;
GLuint i;

View File

@@ -29,7 +29,6 @@
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -492,9 +491,8 @@ ReadConfigFile(const char *filename, struct config_file *conf)
conf->num_uniforms = 0;
/* ugly but functional parser */
while (!feof(f)) {
fgets(line, sizeof(line), f);
if (!feof(f) && line[0]) {
while (fgets(line, sizeof(line), f) != NULL) {
if (line[0]) {
if (strncmp(line, "vs ", 3) == 0) {
VertShaderFile = strdup(line + 3);
VertShaderFile[strlen(VertShaderFile) - 1] = 0;
@@ -550,6 +548,10 @@ ReadConfigFile(const char *filename, struct config_file *conf)
type = TypeFromName(typeName);
if (strlen(name) + 1 > sizeof(conf->uniforms[conf->num_uniforms].name)) {
fprintf(stderr, "string overflow\n");
exit(1);
}
strcpy(conf->uniforms[conf->num_uniforms].name, name);
conf->uniforms[conf->num_uniforms].value[0] = v1;
conf->uniforms[conf->num_uniforms].value[1] = v2;
@@ -627,7 +629,7 @@ Init(void)
NumAttribs = GetAttribs(Program, Attribs);
PrintAttribs(Attribs);
/*assert(glGetError() == 0);*/
/* assert(glGetError() == 0); */
glClearColor(0.4f, 0.4f, 0.8f, 0.0f);

View File

@@ -310,10 +310,8 @@ MakeMipmap(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
/*
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5);
*/
/* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); */
/* glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); */
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
#undef SZ

View File

@@ -40,15 +40,6 @@ static GLboolean Anim = GL_TRUE;
static GLboolean WireFrame = GL_TRUE;
static GLfloat xRot = -70.0f, yRot = 0.0f, zRot = 0.0f;
/* value[0] = tex unit */
static struct uniform_info Uniforms[] = {
{ "tex1", 1, GL_SAMPLER_2D, { 0, 0, 0, 0 }, -1 },
END_OF_UNIFORMS
};
static void
Idle(void)
{

View File

@@ -1,39 +0,0 @@
# progs/vg/Makefile
TOP = ../../..
include $(TOP)/configs/current
VG_LIBS=-lm -pthread -lX11 -lEGL -lOpenVG
INCLUDE_DIRS = -I$(TOP)/include
PROGRAMS = \
lion \
sp
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
lion: lion.o lion-render.o
$(CC) $(CFLAGS) lion.o lion-render.o -L$(TOP)/$(LIB_DIR) $(VG_LIBS) -o $@
lion.o: lion.c lion-render.h $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include lion.c
lion-render.o: lion-render.c lion-render.h $(HEADERS)
$(CC) -c $(CFLAGS) -I$(TOP)/include lion-render.c
sp: sp.c eglcommon.o
$(CC) $(INCLUDE_DIRS) $(CFLAGS) $^ -L$(TOP)/$(LIB_DIR) $(LIBS) $(VG_LIBS) $(APP_LIB_DEPS) -o $@
eglcommon.o: eglcommon.c $(HEADERS)
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) eglcommon.c
clean:
rm -f *.o *~
rm -f *.so
rm -f $(PROGRAMS)

View File

@@ -1,288 +0,0 @@
#include "eglcommon.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <VG/openvg.h> /* using full OpenGL for now */
#include <GLES/egl.h>
static init_func init = 0;
static draw_func draw = 0;
static reshape_func reshape = 0;
static key_func keyPress = 0;
static VGint width = 300, height = 300;
void set_window_size(int w, int h)
{
width = w;
height = h;
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENVG_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (reshape) {
width = event.xconfigure.width;
height = event.xconfigure.height;
reshape(event.xconfigure.width, event.xconfigure.height);
}
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (!keyPress || !keyPress(code)) {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
int window_width(void)
{
return width;
}
int window_height(void)
{
return height;
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int run(int argc, char **argv,
init_func init_f,
reshape_func resh_f,
draw_func draw_f,
key_func key_f)
{
const int winWidth = width, winHeight = height;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
init = init_f;
draw = draw_f;
reshape = resh_f;
keyPress = key_f;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"OpenVG Example", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("VG_RENDERER = %s\n", (char *) vgGetString(VG_RENDERER));
printf("VG_VERSION = %s\n", (char *) vgGetString(VG_VERSION));
printf("VG_VENDOR = %s\n", (char *) vgGetString(VG_VENDOR));
}
if (init)
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
if (reshape)
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglMakeCurrent(egl_dpy, 0, 0, 0);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

View File

@@ -1,20 +0,0 @@
#ifndef EGLCOMMON_H
#define EGLCOMMON_H
typedef void (*init_func)();
typedef void (*reshape_func)(int, int);
typedef void (*draw_func)();
typedef int (*key_func)(unsigned key);
void set_window_size(int width, int height);
int window_width(void);
int window_height(void);
int run(int argc, char **argv,
init_func init,
reshape_func resh,
draw_func draw,
key_func key);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +0,0 @@
#ifndef LION_RENDER_H
#define LION_RENDER_H
#include <VG/openvg.h>
#define LION_SIZE 132
struct lion {
VGPath paths[LION_SIZE];
VGPaint fills[LION_SIZE];
};
struct lion *lion_create(void);
void lion_render(struct lion *l);
void lion_destroy(struct lion *l);
#endif

View File

@@ -1,288 +0,0 @@
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <VG/openvg.h>
#include <GLES/egl.h>
#include "lion-render.h"
static VGint width, height;
struct lion *lion = 0;
VGfloat angle = 0;
static void
draw(void)
{
vgClear(0, 0, width, height);
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();
vgTranslate(width/2, height/2);
vgRotate(angle);
vgTranslate(-width/2, -height/2);
lion_render(lion);
++angle;
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
width = w;
height = h;
}
static void
init(void)
{
float clear_color[4] = {1.0, 1.0, 1.0, 1.0};
vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
lion = lion_create();
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENVG_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
XEvent event;
while (XPending(dpy) > 0) {
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
break;
default:
; /*no-op*/
}
}
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 350, winHeight = 450;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"Lion Example", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("VG_RENDERER = %s\n", (char *) vgGetString(VG_RENDERER));
printf("VG_VERSION = %s\n", (char *) vgGetString(VG_VERSION));
printf("VG_VENDOR = %s\n", (char *) vgGetString(VG_VENDOR));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

View File

@@ -1,537 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <VG/vgu.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <X11/keysym.h>
#define ELEMENTS(x) (sizeof(x)/sizeof((x)[0]))
struct object {
VGPath path;
VGPaint fill;
VGPaint stroke;
VGint draw_mode;
VGfloat matrix[9];
VGfloat stroke_width;
};
struct character {
struct object objects[32];
VGint num_objects;
};
VGfloat identity_matrix[] = {1, 0, 0, 0, 1, 0, 0, 0, 1};
struct character cartman;
static void add_object_fill(const VGubyte *segments, VGint num_segments,
const VGfloat *coords,
VGuint color)
{
struct object object;
object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(object.path, num_segments, segments, coords);
object.fill = vgCreatePaint();
vgSetColor(object.fill, color);
memcpy(object.matrix, identity_matrix, 9 * sizeof(VGfloat));
object.draw_mode = VG_FILL_PATH;
cartman.objects[cartman.num_objects] = object;
++cartman.num_objects;
}
static void add_object_stroke(const VGubyte *segments, VGint num_segments,
const VGfloat *coords,
VGuint color, VGfloat width)
{
struct object object;
object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(object.path, num_segments, segments, coords);
object.stroke = vgCreatePaint();
vgSetColor(object.stroke, color);
memcpy(object.matrix, identity_matrix, 9 * sizeof(VGfloat));
object.draw_mode = VG_STROKE_PATH;
object.stroke_width = width;
cartman.objects[cartman.num_objects] = object;
++cartman.num_objects;
}
static void add_object_fillm(const VGubyte *segments, VGint num_segments,
const VGfloat *coords,
VGuint color,
VGfloat *matrix)
{
struct object object;
object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(object.path, num_segments, segments, coords);
object.fill = vgCreatePaint();
vgSetColor(object.fill, color);
memcpy(object.matrix, matrix, 9 * sizeof(VGfloat));
object.draw_mode = VG_FILL_PATH;
cartman.objects[cartman.num_objects] = object;
++cartman.num_objects;
}
static void add_object_m(const VGubyte *segments, VGint num_segments,
const VGfloat *coords,
VGuint fill_color,
VGuint stroke_color, VGfloat stroke_width,
VGfloat *matrix)
{
struct object object;
object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(object.path, num_segments, segments, coords);
memcpy(object.matrix, matrix, 9 * sizeof(VGfloat));
object.fill = vgCreatePaint();
vgSetColor(object.fill, fill_color);
object.draw_mode = VG_FILL_PATH | VG_STROKE_PATH;
object.stroke = vgCreatePaint();
vgSetColor(object.stroke, stroke_color);
object.stroke_width = stroke_width;
cartman.objects[cartman.num_objects] = object;
++cartman.num_objects;
}
static void init_character()
{
{
const VGubyte segments[] = {VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CLOSE_PATH};
const VGfloat coords[] = {181.83267, 102.60408,
181.83267,102.60408, 185.53793,114.5749, 186.5355,115.00243,
187.53306,115.42996, 286.0073,115.00243, 286.0073,115.00243,
286.0073,115.00243, 292.70526,103.45914, 290.85263,101.03648,
289.00001,98.61381, 181.54765,102.31906, 181.83267,102.60408
};
VGuint color = 0x7c4e32ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CLOSE_PATH
};
const VGfloat coords[] = {188.62208,50.604156,
188.62208,50.604156, 176.73127,60.479579, 170.68509,69.548844,
164.63892,78.618109, 175.11895,79.827344, 175.11895,79.827344,
176.52973,98.368952,
176.52973,98.368952, 189.83131,110.05823, 208.97754,110.25976,
228.12377,110.46131, 244.24691,111.67054, 247.06846,110.25976,
249.89,108.849, 258.95927,106.8336, 260.16851,105.01975,
261.37774,103.2059, 296.84865,106.43053, 297.05019,91.919698,
297.25172,77.408874, 306.11945,64.308824, 282.13628,51.611853,
258.15311,38.914882, 189.2267,49.999539, 188.62208,50.604156
};
VGuint color = 0xe30000ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CLOSE_PATH
};
const VGfloat coords[] = {
68.25, 78.875,
68.25,93.296, 54.642,105, 37.875,105,
21.108,105, 7.5,93.296, 7.5,78.875,
7.5,64.454, 21.108,52.75, 37.875,52.75,
54.642,52.75, 68.25,64.454, 68.25,78.875
};
VGuint color = 0xffe1c4ff;
VGfloat matrix[] = {
1.6529, 0, 0,
0, 1.582037, 0,
172.9649,-90.0116, 1
};
add_object_fillm(segments, ELEMENTS(segments),
coords, color, matrix);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
170.14687,71.536958,
173.53626,68.814326, 176.70232,68.971782, 180.55009,71.679467,
184.39785,74.387153, 199.19294,80.036105, 191.52334,86.500482,
189.02942,88.6025, 183.97032,85.787933, 180.26507,86.928011,
178.8737,87.356121, 174.71827,89.783259, 171.8028,87.494856,
166.95426,83.689139, 163.51779,76.861986, 170.14687,71.536958
};
VGuint color = 0xfff200ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
299.83075,66.834136,
299.83075,66.834136, 287.85993,64.69649, 284.15467,72.962055,
280.44942,81.227621, 280.1644,78.234916, 280.1644,79.374994,
280.1644,80.515072, 278.16927,84.077816, 284.86722,83.792796,
291.56518,83.507777, 291.99271,86.785501, 294.84291,86.642991,
297.6931,86.500482, 303.536,85.645423, 303.67851,80.657582,
303.82102,75.66974, 302.68094,65.551548, 299.83075,66.834136
};
VGuint color = 0xfff200ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS
};
const VGfloat coords[] = {
240.83171,75.81225,
240.83171,75.81225, 241.54426,88.495618, 242.25681,91.488323,
242.96936,94.481028, 240.6892,108.01945, 240.83171,110.01459,
240.97422,112.00973, 240.97422,111.01216, 240.97422,111.01216
};
VGuint color = 0x000000ff;
VGfloat swidth = 1.14007807;
add_object_stroke(segments, ELEMENTS(segments), coords, color, swidth);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
83.375, 95.5,
83.375,96.121, 83.067,96.625, 82.6875,96.625,
82.308,96.625, 82,96.121, 82,95.5,
82,94.879, 82.308,94.375, 82.6875,94.375,
83.066677,94.375, 83.374492,94.878024, 83.374999,95.498494,
82.6875,95.5,
83.375,95.5
};
VGuint fill_color = 0x000000ff;
VGuint stroke_color = 0x000000ff;
VGfloat swidth = 0.60000002;
VGfloat matrix1[] = {
1.140078, 0, 0,
0, 1.140078, 0,
145.4927, -15.10897, 1
};
VGfloat matrix2[] = {
1.140078,0, 0,
0,1.140078, 0,
144.2814,-27.93485, 1
};
VGfloat matrix3[] = {
1.140078,0, 0,
0,1.140078, 0,
144.1388,-3.70819, 1
};
add_object_m(segments, ELEMENTS(segments), coords,
fill_color, stroke_color, swidth, matrix1);
add_object_m(segments, ELEMENTS(segments), coords,
fill_color, stroke_color, swidth, matrix2);
add_object_m(segments, ELEMENTS(segments), coords,
fill_color, stroke_color, swidth, matrix3);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
179.41001,115.28745,
179.41001,115.28745, 207.48443,109.30204, 236.84144,115.14494,
236.84144,115.14494, 274.74903,109.87208, 291.8502,115.42996,
179.41001,115.28745
};
VGuint color = 0x000000ff;
add_object_fill(segments, ELEMENTS(segments),
coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
83.792156,68.157364,
83.792156,69.669865, 82.72301,70.897403, 81.40567,70.897403,
80.08833,70.897403, 79.019185,69.669865, 79.019185,68.157364,
79.019185,66.644862, 80.08833,65.417325, 81.40567,65.417325,
82.721887,65.417325, 83.790391,66.642485, 83.792153,68.153696,
81.40567,68.157364,
83.792156,68.157364
};
VGuint fill_color = 0x000000ff;
VGuint stroke_color = 0x000000ff;
VGfloat swidth = 0.52891117;
VGfloat matrix1[] = {
1.140078,0, 0,
0,1.140078, 0,
145.2489,-15.58714, 1
};
add_object_m(segments, ELEMENTS(segments), coords,
fill_color, stroke_color, swidth, matrix1);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS
};
const VGfloat coords[] = {
232.28113,66.976646,
232.28113,66.976646, 237.98152,70.539389, 245.39202,66.549116
};
VGuint color = 0x000000ff;
VGfloat swidth = 0.60299999;
add_object_stroke(segments, ELEMENTS(segments), coords, color, swidth);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
185.96908,30.061986,
185.96908,30.061986, 187.76995,14.508377, 203.23909,3.7427917,
209.95028,-0.92779696, 219.37764,-4.9841866, 232.1078,-6.00046,
246.13578,-7.1203411, 256.92106,-2.8560739, 264.81774,1.9451947,
280.60485,11.543934, 284.31582,25.937274, 284.08015,26.526452,
283.7266,27.410336, 240.83461,1.9346323, 185.96908,30.061986
};
VGuint color = 0x8ed8f8ff;
add_object_fill(segments, ELEMENTS(segments), coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
185.39542,32.061757,
185.82295,29.211562,
185.82295,29.211562, 234.70379,2.277219, 284.01217,25.078779,
284.86722,27.643954,
284.86722,27.643954, 236.69893,4.5573746, 185.39542,32.061757
};
VGuint color = 0xfff200ff;
add_object_fill(segments, ELEMENTS(segments), coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
219.74027,-5.917093,
220.49206,-8.44929, 225.15564,-10.904934, 230.21473,-11.189954,
235.27383,-11.474973, 243.27521,-13.287236, 249.21385,-5.724198,
249.89961,-4.850868, 249.28247,-4.332166, 248.62298,-3.971398,
247.79117,-3.516361, 247.13703,-3.392737, 246.16222,-3.408047,
243.63973,-3.447664, 242.54183,-3.850701, 242.54183,-3.850701,
242.54183,-3.850701, 238.78367,-1.737343, 236.20014,-3.565682,
233.88436,-5.204544, 234.27626,-4.56325, 234.27626,-4.56325,
234.27626,-4.56325, 232.33303,-2.975658, 230.85603,-2.995643,
228.59433,-3.025282, 227.73672,-4.501857, 227.21966,-4.93027,
226.76318,-4.932008, 226.50948,-4.491995, 226.50948,-4.491995,
226.50948,-4.491995, 224.53199,-2.085883, 222.51431,-2.467064,
221.48814,-2.66093, 218.91968,-3.15318, 219.74027,-5.917093
};
VGuint color = 0xfff200ff;
add_object_fill(segments, ELEMENTS(segments), coords, color);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
178.97347,166.06432,
178.97347,181.2154, 168.0245,193.51193, 154.53381,193.51193,
141.04312,193.51193, 130.09416,181.2154, 130.09416,166.06432,
130.09416,150.91323, 141.04312,138.6167, 154.53381,138.6167,
168.0245,138.6167, 178.97347,150.91323, 178.97347,166.06432
};
VGuint color = 0xffffffff;
VGfloat matrix1[] = {
0.466614,-0.23492, 0,
0.108683,0.436638, 0,
134.5504,-0.901632, 1
};
VGfloat matrix2[] = {
-0.466614,-0.23492, 0,
-0.108683,0.436638, 0,
338.4496,-0.512182, 1
};
add_object_fillm(segments, ELEMENTS(segments), coords, color, matrix1);
add_object_fillm(segments, ELEMENTS(segments), coords, color, matrix2);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS,
VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS, VG_CLOSE_PATH
};
const VGfloat coords[] = {
123.82758,165.06168,
123.82758,166.79125, 122.59232,168.19497, 121.07029,168.19497,
119.54826,168.19497, 118.313,166.79125, 118.313,165.06168,
118.313,163.3321, 119.54826,161.92839, 121.07029,161.92839,
122.59232,161.92839, 123.82758,163.3321, 123.82758,165.06168
};
VGuint color = 0x000000ff;
VGfloat matrix1[] = {
0.525719,0, 0,
0,0.479931, 0,
178.9702,-43.3532, 1
};
VGfloat matrix2[] = {
0.525719,0, 0,
0,0.479931, 0,
165.258,-43.46162, 1
};
add_object_fillm(segments, ELEMENTS(segments), coords, color, matrix1);
add_object_fillm(segments, ELEMENTS(segments), coords, color, matrix2);
}
{
const VGubyte segments[] = {
VG_MOVE_TO_ABS, VG_CUBIC_TO_ABS, VG_CUBIC_TO_ABS
};
const VGfloat coords[] = {
197.25,54.5,
197.25,54.5, 211.75,71.5, 229.25,71.5,
246.75,71.5, 261.74147,71.132714, 277.75,50.75
};
VGuint color = 0x000000ff;
VGfloat swidth = 0.60299999;
add_object_stroke(segments, ELEMENTS(segments), coords, color, swidth);
}
}
static void
init(void)
{
float clear_color[4] = {1.0, 1.0, 1.0, 1.0};
vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
init_character();
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static int
key_press(unsigned key)
{
switch(key) {
case XK_Right:
break;
case XK_Left:
break;
case XK_Up:
break;
case XK_Down:
break;
case 'a':
break;
case 's':
break;
default:
break;
}
return VG_FALSE;
}
static void
draw(void)
{
VGint i;
VGfloat save_matrix[9];
vgClear(0, 0, window_width(), window_height());
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();
vgScale(2, 2);
vgTranslate(160, 60);
vgRotate(180);
vgTranslate(-160, -100);
vgGetMatrix(save_matrix);
for (i = 0; i < cartman.num_objects; ++i) {
struct object object = cartman.objects[i];
if ((object.draw_mode & VG_STROKE_PATH)) {
vgSetf(VG_STROKE_LINE_WIDTH, object.stroke_width);
vgSetPaint(object.stroke, VG_STROKE_PATH);
}
if ((object.draw_mode & VG_FILL_PATH))
vgSetPaint(object.fill, VG_FILL_PATH);
vgMultMatrix(object.matrix);
vgDrawPath(object.path, object.draw_mode);
vgLoadMatrix(save_matrix);
}
vgFlush();
}
int main(int argc, char **argv)
{
set_window_size(400, 400);
return run(argc, argv, init, reshape, draw, key_press);
}

View File

@@ -1,127 +0,0 @@
# These programs aren't intended to be included with the normal distro.
# They're not too interesting but they're good for testing.
TOP = ../../../
include $(TOP)/configs/current
INCLUDES = -I. -I$(TOP)/include
LIBS=-L$(TOP)/$(LIB_DIR) -lm -lX11 -lEGL -lOpenVG -lpthread
CFLAGS += $(INCLUDES)
HEADERS=eglcommon.h
PROGRAMS = \
arc \
cap \
clear \
coord \
dash \
ellipse \
filter \
gradorigin \
lineto \
lingrad \
lookup \
mask4 \
mask \
path3 \
radialgrad \
readpixels \
roundedrect \
star-nonzero \
star-oddeven \
stroke2 \
stroke \
vguarc
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
arc: arc.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
cap: cap.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
clear: clear.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
coord: coord.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
dash: dash.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
ellipse: ellipse.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
filter: filter.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
gradorigin: gradorigin.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
image: image.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
lineto: lineto.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
lingrad: lingrad.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
lookup: lookup.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
mask: mask.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
mask4: mask4.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
path3: path3.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
pattern: pattern.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
radialgrad: radialgrad.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
readpixels: readpixels.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
roundedrect: roundedrect.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
star-nonzero: star-nonzero.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
star-oddeven: star-oddeven.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
stroke: stroke.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
stroke2: stroke2.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
vguarc: vguarc.c eglcommon.o
$(CC) $(CFLAGS) $^ $(LIBS) $(APP_LIB_DEPS) -o $@
eglcommon.o: eglcommon.c $(HEADERS)
$(CC) -c $(CFLAGS) eglcommon.c
clean:
rm -f *.o *~
rm -f *.so
rm -f $(PROGRAMS)

View File

@@ -1,139 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <math.h>
const VGfloat clear_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {1.0, 1.0, 1.0, 0.5};
VGPath vgPath;
static void ellipse(VGPath vgPath, VGfloat rx, VGfloat ry, VGfloat angle)
{
static const VGubyte cmd[] =
{ VG_MOVE_TO_ABS, VG_SCCWARC_TO_REL, VG_SCCWARC_TO_REL, VG_CLOSE_PATH };
VGfloat val[12];
VGfloat c = cos(angle) * rx;
VGfloat s = sin(angle) * rx;
val[0] = c;
val[1] = s;
val[2] = rx;
val[3] = ry;
val[4] = angle;
val[5] = -2.0f * c;
val[6] = -2.0f * s;
val[7] = rx;
val[8] = ry;
val[9] = angle;
val[10] = 2.0f * c;
val[11] = 2.0f * s;
vgClearPath(vgPath, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(vgPath, sizeof(cmd), cmd, val);
vgDrawPath(vgPath, VG_FILL_PATH | VG_STROKE_PATH);
}
static void
init(void)
{
VGPaint vgPaint;
vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
vgPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0,
VG_PATH_CAPABILITY_ALL);
vgPaint = vgCreatePaint();
vgSetParameteri(vgPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgSetColor(vgPaint, 0x00ff00ff);
vgSetPaint(vgPaint, VG_FILL_PATH);
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
vgSetf(VG_STROKE_LINE_WIDTH, 2.0f);
vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_SQUARE);
vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_MITER);
vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
#if 0
vgLoadIdentity();
vgTranslate(40.0f, 24.0f);
vgScale(0.61804f, 0.61804f);
vgShear(-1.0f, 0.0f);
vgDrawPath(vgPath, VG_FILL_PATH | VG_STROKE_PATH);
#else
/* row 1, col 1: Identity transform. */
vgLoadIdentity();
vgTranslate(8.0f, 8.0f);
ellipse(vgPath, 4.0f, 4.0f, 0.0f);
/* row 1, col 2: 10^3 horizontal squeeze. */
vgLoadIdentity();
vgTranslate(24.0f, 8.0f);
vgScale(1.0e-3f, 1.0f);
ellipse(vgPath, 4.0e3f, 4.0f, 0.0f);
/* row 1, col 3: 10^6 horizontal squeeze. */
vgLoadIdentity();
vgTranslate(40.0f, 8.0f);
vgScale(1.0e-6f, 1.0f);
ellipse(vgPath, 4.0e6f, 4.0f, 0.0f);
/* row 1, col 4: 10^9 horizontal squeeze. */
vgLoadIdentity();
vgTranslate(56.0f, 8.0f);
vgScale(1.0e-9f, 1.0f);
ellipse(vgPath, 4.0e9f, 4.0f, 0.0f);
/* row 2, col 1: 10^3 vertical squeeze. */
vgLoadIdentity();
vgTranslate(8.0f, 24.0f);
vgScale(1.0f, 1.0e-3f);
ellipse(vgPath, 4.0f, 4.0e3f, 0.0f);
/* row 2, col 2: Shear 0. */
vgLoadIdentity();
vgTranslate(24.0f, 24.0f);
vgShear(0.0f, 0.0f);
ellipse(vgPath, 4.0f, 4.0f, 0.0f);
/* row 2, col 3: Horizontal shear -1. */
vgLoadIdentity();
vgTranslate(40.0f, 24.0f);
vgScale(0.61804f, 0.61804f);
vgShear(-1.0f, 0.0f);
ellipse(vgPath, 10.47213f, 4.0f, 31.717f);
#endif
vgFlush();
}
int main(int argc, char **argv)
{
set_window_size(64, 64);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,75 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
static void
init(void)
{
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
const int subtest = 0;
static void
draw(void)
{
VGPath line;
VGPaint fillPaint;
VGubyte lineCommands[3] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS};
VGfloat lineCoords[] = {-2.0f,-1.0f, 0.0f,0.0f, -1.0f, -2.0f};
VGfloat clearColor[] = {0.0f, 0.0f, 0.0f, 1.0f};/* black color */
VGfloat fillColor[] = {1.0f, 1.0f, 1.0f, 1.0f};/* white color */
//VGfloat testRadius = 60.0f;
VGfloat testRadius = 10.0f;
int WINDSIZEX = window_width();
int WINDSIZEY = window_height();
line = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
fillPaint = vgCreatePaint();
vgSetf(VG_STROKE_LINE_WIDTH, 1.0f);
//vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_ROUND);
vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
//vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_BEVEL);
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_BETTER);
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();
vgTranslate(60, 60);
vgScale(testRadius * 2, testRadius * 2);
vgAppendPathData(line, 3, lineCommands, lineCoords);
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
vgSetPaint(fillPaint, VG_STROKE_PATH);
vgSetParameterfv(fillPaint, VG_PAINT_COLOR, 4, fillColor);
vgSetParameteri( fillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgClear(0, 0, WINDSIZEX, WINDSIZEY);
vgDrawPath(line, VG_STROKE_PATH);
vgDestroyPath(line);
vgDestroyPaint(fillPaint);
}
int main(int argc, char **argv)
{
set_window_size(100, 100);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,42 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <stdio.h>
float red_color[4] = {1.0, 0.0, 0.0, 1.0};
float blue_color[4] = {0.0, 0.0, 1.0, 1.0};
static void
init(void)
{
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
VGint scissor[4] = {100, 100, 25, 25};
vgSetfv(VG_CLEAR_COLOR, 4, red_color);
vgClear(0, 0, window_width(), window_height());
vgSetfv(VG_CLEAR_COLOR, 4, blue_color);
vgClear(50, 50, 50, 50);
//vgSetiv(VG_SCISSOR_RECTS, 4, scissor);
//vgSeti(VG_SCISSORING, VG_TRUE);
vgCopyPixels(100, 100, 50, 50, 50, 50);
vgClear(150, 150, 50, 50);
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,66 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {0.4, 0.1, 1.0, 1.0};
VGPath path;
VGPaint fill;
static void
init(void)
{
/* Absent VG_CLOSE_PATH */
VGubyte commands[] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS};
VGfloat clearColor[] = {1.0f, 1.0f, 1.0f, 1.0f};/* white color */
VGfloat fillColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
VGfloat coords[] = {-16.0f, -16.0f, 0.0f, -16.0f, 0.0f, 0.0f, -16.0f, 0.0f,
0.0f, 0.0f, 16.0f, 0.0f, 16.0f, 16.0f, 0.0f, 16.0f};
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();
vgTranslate(32.0f, 32.0f);
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0,
VG_PATH_CAPABILITY_ALL);
if (path == VG_INVALID_HANDLE)
return;
fill = vgCreatePaint();
if (fill == VG_INVALID_HANDLE) {
vgDestroyPath(path);
return;
}
vgAppendPathData(path, 8, commands, coords);
vgSetPaint(fill, VG_FILL_PATH);
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, fillColor);
vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_FILL_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
set_window_size(64, 64);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,95 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <X11/keysym.h>
#include <stdio.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {0.4, 0.1, 1.0, 1.0};
VGPath path;
VGPaint fill;
VGint cap_style = VG_CAP_BUTT;
static void
init(void)
{
static const VGubyte cmds[] = {VG_MOVE_TO_ABS,
VG_LINE_TO_ABS,
VG_LINE_TO_ABS
};
#if 1
static const VGfloat coords[] = {100, 100, 150, 100,
150, 200
};
#else
static const VGfloat coords[] = {100, 20, 100, 220,
};
#endif
VGfloat dash_pattern[2] = { 20.f, 20.f };
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO);
vgAppendPathData(path, 3, cmds, coords);
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
vgSetPaint(fill, VG_FILL_PATH);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
vgSetf(VG_STROKE_LINE_WIDTH, 20);
vgSeti(VG_STROKE_CAP_STYLE, cap_style);
vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
vgSetfv(VG_STROKE_DASH_PATTERN, 2, dash_pattern);
vgSetf(VG_STROKE_DASH_PHASE, 0.0f);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_STROKE_PATH);
vgFlush();
}
static int key_press(unsigned key)
{
switch(key) {
case XK_c:
case XK_C:
++cap_style;
if (cap_style > VG_CAP_SQUARE)
cap_style = VG_CAP_BUTT;
switch(cap_style) {
case VG_CAP_BUTT:
fprintf(stderr, "Cap style 'butt'\n");
break;
case VG_CAP_ROUND:
fprintf(stderr, "Cap style 'round'\n");
break;
case VG_CAP_SQUARE:
fprintf(stderr, "Cap style 'square'\n");
break;
}
vgSeti(VG_STROKE_CAP_STYLE, cap_style);
break;
default:
break;
}
return VG_TRUE;
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, key_press);
}

View File

@@ -1,288 +0,0 @@
#include "eglcommon.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <VG/openvg.h> /* using full OpenGL for now */
#include <GLES/egl.h>
static init_func init = 0;
static draw_func draw = 0;
static reshape_func reshape = 0;
static key_func keyPress = 0;
static VGint width = 300, height = 300;
void set_window_size(int w, int h)
{
width = w;
height = h;
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENVG_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (reshape) {
width = event.xconfigure.width;
height = event.xconfigure.height;
reshape(event.xconfigure.width, event.xconfigure.height);
}
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (!keyPress || !keyPress(code)) {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
int window_width(void)
{
return width;
}
int window_height(void)
{
return height;
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int run(int argc, char **argv,
init_func init_f,
reshape_func resh_f,
draw_func draw_f,
key_func key_f)
{
const int winWidth = width, winHeight = height;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
init = init_f;
draw = draw_f;
reshape = resh_f;
keyPress = key_f;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"OpenVG Example", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("VG_RENDERER = %s\n", (char *) vgGetString(VG_RENDERER));
printf("VG_VERSION = %s\n", (char *) vgGetString(VG_VERSION));
printf("VG_VENDOR = %s\n", (char *) vgGetString(VG_VENDOR));
}
if (init)
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
if (reshape)
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglMakeCurrent(egl_dpy, 0, 0, 0);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

View File

@@ -1,20 +0,0 @@
#ifndef EGLCOMMON_H
#define EGLCOMMON_H
typedef void (*init_func)();
typedef void (*reshape_func)(int, int);
typedef void (*draw_func)();
typedef int (*key_func)(unsigned key);
void set_window_size(int width, int height);
int window_width(void);
int window_height(void);
int run(int argc, char **argv,
init_func init,
reshape_func resh,
draw_func draw,
key_func key);
#endif

View File

@@ -1,84 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <math.h>
#include <stdlib.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {0.0, 0.0, 0.0, 1.0};
VGPath path;
VGPaint paint;
static void
init(void)
{
VGfloat clearColor[] = {1.0f, 1.0f, 1.0f, 1.0f};/* white color */
VGfloat fillColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
static const VGubyte segments[4] = {VG_MOVE_TO_ABS,
VG_SCCWARC_TO_ABS,
VG_SCCWARC_TO_ABS,
VG_CLOSE_PATH};
VGfloat data[12];
const VGfloat cx = 0, cy=29, width=80, height=40;
const VGfloat hw = width * 0.5f;
const VGfloat hh = height * 0.5f;
data[0] = cx + hw;
data[1] = cy;
data[2] = hw;
data[3] = hh;
data[4] = 0;
data[5] = cx - hw;
data[6] = cy;
data[7] = hw;
data[8] = hh;
data[9] = 0;
data[10] = data[0];
data[11] = cy;
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
if (path == VG_INVALID_HANDLE) {
return;
}
paint = vgCreatePaint();
if (paint == VG_INVALID_HANDLE) {
vgDestroyPath(path);
return;
}
vgAppendPathData(path, 4, segments, data);
vgSetParameterfv(paint, VG_PAINT_COLOR, 4, fillColor);
vgSetParameteri( paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgSetPaint(paint, VG_FILL_PATH);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgLoadIdentity();
vgTranslate(50, 21);
vgDrawPath(path, VG_FILL_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
set_window_size(100, 100);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,107 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {1.0, 1.0, 1.0, 0.5};
VGImage srcImg;
VGImage dstImg;
VGPaint fill;
VGfloat bgCol[4] = {0.906f, 0.914f, 0.761f, 1.0f};
static void
init(void)
{
VGfloat red[4];
VGfloat grey[4];
VGfloat orange[4];
VGfloat blue[4];
VGfloat black[4];
VGfloat white[4];
VGshort transKernel[49] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
red[0] = 0.6710f;
red[1] = 0.1060f;
red[2] = 0.1330f;
red[3] = 1.0f;
grey[0] = 0.6347f;
grey[1] = 0.6561f;
grey[2] = 0.6057f;
grey[3] = 1.0f;
orange[0] = 1.0000f;
orange[1] = 0.8227f;
orange[2] = 0.5057f;
orange[3] = 1.0f;
blue[0] = 0.0000f;
blue[1] = 0.6908f;
blue[2] = 0.8595f;
blue[3] = 1.0f;
black[0] = 0;
black[1] = 0;
black[2] = 0;
black[3] = 1.0f;
white[0] = 1;
white[1] = 1;
white[2] = 1;
white[3] = 1.0f;
vgSetfv(VG_TILE_FILL_COLOR, 4, blue);
vgSeti(VG_FILTER_CHANNEL_MASK, 14);
/* Setup images */
srcImg = vgCreateImage(VG_sRGBA_8888, 32, 32,
VG_IMAGE_QUALITY_NONANTIALIASED);
dstImg = vgCreateImage(VG_sRGBA_8888, 32, 32,
VG_IMAGE_QUALITY_NONANTIALIASED);
vgSetfv(VG_CLEAR_COLOR, 4, black);
vgClearImage(srcImg, 0, 0, 32, 32);
vgSetfv(VG_CLEAR_COLOR, 4, red);
vgClearImage(srcImg, 3, 3, 27, 27);
vgSetfv(VG_CLEAR_COLOR, 4, orange);
vgClearImage(dstImg, 0, 0, 32, 32);
transKernel[8] = 1;
vgConvolve(dstImg, srcImg, 3, 3, 3, 0, transKernel,
1, 0, VG_TILE_FILL);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static void
draw(void)
{
vgSetfv(VG_CLEAR_COLOR, 4, bgCol);
vgClear(0, 0, window_width(), window_height());
vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
vgLoadIdentity();
vgTranslate(10, 10);
vgDrawImage(dstImg);
vgFlush();
}
int main(int argc, char **argv)
{
set_window_size(64, 64);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,98 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <stdio.h>
#include <string.h>
static const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
static VGPath path;
static VGPaint fill;
VGColorRampSpreadMode spread = VG_COLOR_RAMP_SPREAD_PAD;
static void
init(void)
{
VGubyte commands[5] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_CLOSE_PATH};
VGfloat coords[8] = {0.0f,0.0f, 32.0f,0.0f, 32.0f,32.0f, 0.0f,32.0f };
VGfloat rampStop[20] = {-0.5f, 1.0f, 1.0f, 1.0f, 1.0f,
0.25f, 1.0f, 0.0f, 0.0f, 1.0f,
0.75f, 0.0f, 0.0f, 1.0f, 1.0f,
1.5f, 0.0f, 0.0f, 0.0f, 0.0f};
VGfloat defaultColor[] = {1.0f, 1.0f, 1.0f, 1.0f};
VGfloat linearGradient[4] = {0.0f, 0.0f, 0.0f, 32.0f};
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
if (path == VG_INVALID_HANDLE)
return;
fill = vgCreatePaint();
if (fill == VG_INVALID_HANDLE) {
vgDestroyPath(path);
return;
}
vgSetfv(VG_CLEAR_COLOR, 4, defaultColor);
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
vgAppendPathData(path, 5, commands, coords);
vgSetPaint(fill, VG_FILL_PATH);
vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
vgSetParameteri(fill, VG_PAINT_COLOR_RAMP_SPREAD_MODE,
VG_COLOR_RAMP_SPREAD_REPEAT);
vgSetParameterfv(fill, VG_PAINT_LINEAR_GRADIENT, 4, linearGradient);
vgSetParameterfv(fill, VG_PAINT_COLOR_RAMP_STOPS, 20, rampStop);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_FILL_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
if (argc > 1) {
const char *arg = argv[1];
if (!strcmp("-pad", arg))
spread = VG_COLOR_RAMP_SPREAD_PAD;
else if (!strcmp("-repeat", arg))
spread = VG_COLOR_RAMP_SPREAD_REPEAT;
else if (!strcmp("-reflect", arg))
spread = VG_COLOR_RAMP_SPREAD_REFLECT;
}
switch(spread) {
case VG_COLOR_RAMP_SPREAD_PAD:
printf("Using spread mode: pad\n");
break;
case VG_COLOR_RAMP_SPREAD_REPEAT:
printf("Using spread mode: repeat\n");
break;
case VG_COLOR_RAMP_SPREAD_REFLECT:
printf("Using spread mode: reflect\n");
}
set_window_size(200, 200);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,56 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {0.4, 0.1, 1.0, 1.0};
VGPath path;
VGPaint fill;
static void
init(void)
{
static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
static const VGfloat sqrCoords[5] = {50.0f, 50.0f, 250.0f, 250.0f, 50.0f};
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO);
vgAppendPathData(path, 5, sqrCmds, sqrCoords);
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
vgSetPaint(fill, VG_FILL_PATH);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
vgSetf(VG_STROKE_LINE_WIDTH, 10);
vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgSeti(VG_MATRIX_MODE, VG_MATRIX_STROKE_PAINT_TO_USER);
vgLoadIdentity();
vgScale(2.25, 2.25);
vgDrawPath(path, VG_STROKE_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,87 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <stdio.h>
#include <string.h>
static const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
static VGPath path;
static VGPaint fill;
VGColorRampSpreadMode spread = VG_COLOR_RAMP_SPREAD_PAD;
static void
init(void)
{
static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
static const VGfloat sqrCoords[5] = {0.0f, 0.0f, 400.0f, 400.0f, 0.0f};
VGfloat rampStop[] = {0.00f, 1.0f, 1.0f, 1.0f, 1.0f,
0.33f, 1.0f, 0.0f, 0.0f, 1.0f,
0.66f, 0.0f, 1.0f, 0.0f, 1.0f,
1.00f, 0.0f, 0.0f, 1.0f, 1.0f};
VGfloat linearGradient[4] = {100.0f, 100.0f, 300.0f, 300.0f};
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO);
vgAppendPathData(path, 5, sqrCmds, sqrCoords);
fill = vgCreatePaint();
vgSetPaint(fill, VG_FILL_PATH);
vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
vgSetParameteri(fill, VG_PAINT_COLOR_RAMP_SPREAD_MODE, spread);
vgSetParameterfv(fill, VG_PAINT_LINEAR_GRADIENT, 4, linearGradient);
vgSetParameterfv(fill, VG_PAINT_COLOR_RAMP_STOPS, 20, rampStop);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_FILL_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
if (argc > 1) {
const char *arg = argv[1];
if (!strcmp("-pad", arg))
spread = VG_COLOR_RAMP_SPREAD_PAD;
else if (!strcmp("-repeat", arg))
spread = VG_COLOR_RAMP_SPREAD_REPEAT;
else if (!strcmp("-reflect", arg))
spread = VG_COLOR_RAMP_SPREAD_REFLECT;
}
switch(spread) {
case VG_COLOR_RAMP_SPREAD_PAD:
printf("Using spread mode: pad\n");
break;
case VG_COLOR_RAMP_SPREAD_REPEAT:
printf("Using spread mode: repeat\n");
break;
case VG_COLOR_RAMP_SPREAD_REFLECT:
printf("Using spread mode: reflect\n");
}
set_window_size(400, 400);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,71 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {1.0, 1.0, 1.0, 0.5};
VGfloat clearColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
VGImage parent;
VGPaint fill;
static void
init(void)
{
VGImage child1, child2;
VGubyte *data;
VGuint LUT[256];
VGint i;
data = (VGubyte *)malloc(sizeof(VGubyte)*window_width()*window_height());
for (i=0;i<window_width()*window_height();i++) {
data[i] = 0x00;
}
for (i=0; i<256; i++) {
if ( i == 0 )
LUT[0] = 0xFFFFFFFF;
else
LUT[i] = 0xFF00FFFF;
}
parent = vgCreateImage( VG_A_8, 64, 64, VG_IMAGE_QUALITY_NONANTIALIASED );
vgImageSubData(parent, data, window_width(), VG_A_8, 0, 0,
window_width(), window_height());
child1 = vgChildImage(parent, 0, 0, 32, 64);
child2 = vgChildImage(parent, 32, 0, 32, 64);
vgLookupSingle(child2, child1, LUT, VG_GREEN, VG_FALSE, VG_TRUE);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static void
draw(void)
{
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
vgClear(0, 0, window_width(), window_height());
//vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
//vgLoadIdentity();
//vgTranslate(10, 10);
vgDrawImage(parent);
vgFlush();
}
int main(int argc, char **argv)
{
set_window_size(64, 64);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,58 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {0.4, 0.1, 1.0, 1.0};
VGPath path;
VGPaint fill;
static void
init(void)
{
static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
static const VGfloat sqrCoords[5] = {50.0f, 50.0f, 250.0f, 250.0f, 50.0f};
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO);
vgAppendPathData(path, 5, sqrCmds, sqrCoords);
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
vgSetPaint(fill, VG_FILL_PATH);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
vgSetf(VG_STROKE_LINE_WIDTH, 10);
vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);
vgSeti(VG_MASKING, VG_TRUE);
vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK,
25, 25, 100, 100);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_FILL_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,132 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <VG/vgu.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <X11/keysym.h>
//VGint x_pos = -10, y_pos = -10;
VGint x_pos = 0, y_pos = 4;
VGint img_width = 120, img_height = 120;
static void RectToPath(VGPath path, VGfloat x, VGfloat y, VGfloat width, VGfloat height)
{
static const VGubyte segments[5] = {VG_MOVE_TO_ABS,
VG_HLINE_TO_ABS,
VG_VLINE_TO_ABS,
VG_HLINE_TO_ABS,
VG_CLOSE_PATH};
VGfloat data[5];
data[0] = x;
data[1] = y;
data[2] = x + width;
data[3] = y + height;
data[4] = x;
vgAppendPathData(path, 5, segments, data);
}
static void
init(void)
{
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
int key_press(unsigned key)
{
switch(key) {
case XK_Right:
x_pos +=1;
break;
case XK_Left:
x_pos -=1;
break;
case XK_Up:
y_pos +=1;
break;
case XK_Down:
y_pos -=1;
break;
case 'a':
img_width -= 5;
img_height -= 5;
break;
case 's':
img_width += 5;
img_height += 5;
break;
default:
break;
}
fprintf(stderr, "Posi = %dx%d\n", x_pos, y_pos);
fprintf(stderr, "Size = %dx%d\n", img_width, img_height);
return VG_FALSE;
}
static void
draw(void)
{
VGint WINDSIZEX = window_width();
VGint WINDSIZEY = window_height();
VGPaint fill;
VGPath box;
VGfloat color[4] = {1.f, 0.f, 0.f, 1.f};
VGfloat bgCol[4] = {0.7f, 0.7f, 0.7f, 1.0f};
VGfloat transCol[4] = {0.f, 0.f, 0.f, 0.f};
VGImage image = vgCreateImage(VG_sRGBA_8888, img_width, img_height,
VG_IMAGE_QUALITY_NONANTIALIASED);
/* Background clear */
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
vgSetPaint(fill, VG_FILL_PATH);
box = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
/* Rectangle to cover completely 16x16 pixel area. */
RectToPath(box, 0, 0, 64, 64);
vgSetfv(VG_CLEAR_COLOR, 4, transCol);
vgClearImage(image, 0, 0, img_width, img_height);
vgSetfv(VG_CLEAR_COLOR, 4, color);
vgClearImage(image, 10, 10, 12, 12);
//vgImageSubData(image, pukki_64x64_data, pukki_64x64_stride,
// VG_sRGBA_8888, 0, 0, 32, 32);
vgSeti(VG_MASKING, VG_TRUE);
vgLoadIdentity();
vgSetfv(VG_CLEAR_COLOR, 4, bgCol);
vgClear(0, 0, WINDSIZEX, WINDSIZEY);
vgMask(image, VG_FILL_MASK, 0, 0, window_width(), window_height());
vgMask(image, VG_SET_MASK, x_pos, y_pos, 100, 100);
vgDrawPath(box, VG_FILL_PATH);
//vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
//vgTranslate(-10, -10);
//vgDrawImage(image);
vgDestroyPaint(fill);
vgDestroyPath(box);
}
int main(int argc, char **argv)
{
set_window_size(64, 64);
return run(argc, argv, init, reshape,
draw, key_press);
}

View File

@@ -1,77 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <VG/vgu.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
static void
init(void)
{
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static void
draw(void)
{
VGint WINDSIZEX = window_width();
VGint WINDSIZEY = window_height();
VGPath path;
VGPaint paint;
VGfloat clearColor[] = {1.0f, 1.0f, 1.0f, 0.0f};/* white color */
VGfloat fillColor[] = {1.0f, 0.0f, 0.0f, 1.0f};/* red color */
#if 1
VGubyte commands[4] = {VG_MOVE_TO_ABS, VG_LCWARC_TO_ABS, VG_SCWARC_TO_ABS, VG_CLOSE_PATH};
#else
VGubyte commands[4] = {VG_MOVE_TO_ABS, VG_SCCWARC_TO_ABS, VG_LCCWARC_TO_ABS,VG_CLOSE_PATH};
#endif
VGfloat coords[] = {32.0f, 0.0f,
-32.0f, -32.0f, 0.0f, 64.0f, 32.0f,
-32.0f, -32.0f, 0.0f, 32.0f, 0.0f};
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
vgClear(0, 0, WINDSIZEX, WINDSIZEY);
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();
//vgTranslate(32.0f, 32.0f);
path = vgCreatePath( VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL );
if ( path == VG_INVALID_HANDLE ) {
return;
}
paint = vgCreatePaint();
if ( paint == VG_INVALID_HANDLE ) {
vgDestroyPath(path);
return;
}
vgAppendPathData(path, 4, commands, coords);
vgSetParameterfv(paint, VG_PAINT_COLOR, 4, fillColor);
vgSetParameteri( paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgSetPaint(paint, VG_FILL_PATH);
vgDrawPath(path, VG_FILL_PATH);
vgDestroyPath(path);
vgDestroyPaint(paint);
}
int main(int argc, char **argv)
{
set_window_size(64, 64);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,99 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <stdio.h>
#include <string.h>
static const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
static VGPath path;
static VGPaint fill;
VGfloat centeredGradient[5] = {200.0f, 200.0f, 200.0f, 200.0f, 100};
VGfloat noncenteredGradient[5] = {200.0f, 200.0f, 250.0f, 250.0f, 100};
VGfloat *radialGradient = centeredGradient;
VGColorRampSpreadMode spread = VG_COLOR_RAMP_SPREAD_PAD;
static void
init(void)
{
static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
static const VGfloat sqrCoords[5] = {0.0f, 0.0f, 400.0f, 400.0f, 0.0f};
VGfloat rampStop[] = {0.00f, 1.0f, 1.0f, 1.0f, 1.0f,
0.33f, 1.0f, 0.0f, 0.0f, 1.0f,
0.66f, 0.0f, 1.0f, 0.0f, 1.0f,
1.00f, 0.0f, 0.0f, 1.0f, 1.0f};
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO);
vgAppendPathData(path, 5, sqrCmds, sqrCoords);
fill = vgCreatePaint();
vgSetPaint(fill, VG_FILL_PATH);
vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT);
vgSetParameteri(fill, VG_PAINT_COLOR_RAMP_SPREAD_MODE, spread);
vgSetParameterfv(fill, VG_PAINT_RADIAL_GRADIENT, 5, radialGradient);
vgSetParameterfv(fill, VG_PAINT_COLOR_RAMP_STOPS, 20, rampStop);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_FILL_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
VGint i;
for (i = 1; i < argc; ++i) {
const char *arg = argv[i];
if (!strcmp("-pad", arg))
spread = VG_COLOR_RAMP_SPREAD_PAD;
else if (!strcmp("-repeat", arg))
spread = VG_COLOR_RAMP_SPREAD_REPEAT;
else if (!strcmp("-reflect", arg))
spread = VG_COLOR_RAMP_SPREAD_REFLECT;
else if (!strcmp("-center", arg)) {
printf("Centered radial gradient\n");
radialGradient = centeredGradient;
} else if (!strcmp("-noncenter", arg)) {
printf("Non centered radial gradient\n");
radialGradient = noncenteredGradient;
}
}
switch(spread) {
case VG_COLOR_RAMP_SPREAD_PAD:
printf("Using spread mode: pad\n");
break;
case VG_COLOR_RAMP_SPREAD_REPEAT:
printf("Using spread mode: repeat\n");
break;
case VG_COLOR_RAMP_SPREAD_REFLECT:
printf("Using spread mode: reflect\n");
}
set_window_size(400, 400);
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,75 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
float red_color[4] = {1.0, 0.0, 0.0, 1.0};
float blue_color[4] = {0.0, 0.0, 1.0, 1.0};
VGint *data;
static void
init(void)
{
data = malloc(sizeof(VGint)*2048*2048);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
static const VGint red_pixel = 255 << 24 | 255 << 16 | 0 << 8 | 0;
static const VGint blue_pixel = 255 << 24 | 0 << 16 | 0 << 8 | 255;
VGint i;
vgSetfv(VG_CLEAR_COLOR, 4, red_color);
vgClear(0, 0, window_width(), window_height());
vgFlush();
memset(data, 0, window_width() * window_height() * sizeof(VGint));
vgReadPixels(data, window_width() * sizeof(VGint),
VG_lARGB_8888,
0, 0, window_width(), window_height());
fprintf(stderr, "Red 0 = 0x%x and at 600 = 0x%x\n",
data[0], data[600]);
for (i = 0; i < window_width() * window_height(); ++i) {
assert(data[i] == red_pixel);
}
vgSetfv(VG_CLEAR_COLOR, 4, blue_color);
vgClear(50, 50, 50, 50);
vgFlush();
memset(data, 0, window_width() * window_height() * sizeof(VGint));
vgReadPixels(data, 50 * sizeof(VGint),
VG_lARGB_8888,
50, 50, 50, 50);
fprintf(stderr, "Blue 0 = 0x%x and at 100 = 0x%x\n",
data[0], data[100]);
for (i = 0; i < 50 * 50; ++i) {
assert(data[i] == blue_pixel);
}
}
int main(int argc, char **argv)
{
int ret = run(argc, argv, init, reshape,
draw, 0);
free(data);
return ret;
}

View File

@@ -1,67 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {0.9, 0.1, 0.1, 0.8};
VGPath path;
VGPaint fill;
static void
init(void)
{
static const VGubyte sqrCmds[10] = {VG_MOVE_TO_ABS,
VG_LINE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_LINE_TO_ABS,
VG_CUBIC_TO_ABS,
VG_CLOSE_PATH};
static const VGfloat sqrCoords[] = {
45.885571, 62.857143,
154.11442, 62.857143,
162.1236, 62.857143, 168.57142, 70.260744, 168.57142, 79.457144,
168.57142, 123.4,
168.57142, 132.5964, 162.1236, 140, 154.11442, 140,
45.885571, 140,
37.876394, 140, 31.428572, 132.5964, 31.428572, 123.4,
31.428572, 79.457144,
31.428572, 70.260744, 37.876394,62.857143, 45.885571,62.857143
};
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO);
vgAppendPathData(path, 10, sqrCmds, sqrCoords);
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
vgSetPaint(fill, VG_FILL_PATH);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
vgSetf(VG_STROKE_LINE_WIDTH, 6);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_STROKE_PATH);
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,55 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat green_color[4] = {0.0, 1.0, 0.0, 0.8};
VGPath path;
VGPaint fill;
static void
init(void)
{
static const VGubyte cmds[6] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
VG_LINE_TO_ABS, VG_CLOSE_PATH};
static const VGfloat coords[] = { 0, 200,
300, 200,
50, 0,
150, 300,
250, 0};
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO);
vgAppendPathData(path, 6, cmds, coords);
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, green_color);
vgSetPaint(fill, VG_FILL_PATH);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
vgSeti(VG_FILL_RULE, VG_NON_ZERO);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_FILL_PATH | VG_STROKE_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,102 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat green_color[4] = {0.0, 1.0, 0.0, 0.8};
const VGfloat black_color[4] = {0.0, 0.0, 0.0, 1.0};
VGPath path;
VGPaint fill;
static void draw_point(VGfloat x, VGfloat y)
{
static const VGubyte cmds[] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
VG_LINE_TO_ABS, VG_CLOSE_PATH};
const VGfloat coords[] = { x - 2, y - 2,
x + 2, y - 2,
x + 2, y + 2,
x - 2, y + 2};
VGPath path;
VGPaint fill;
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_ALL);
vgAppendPathData(path, 5, cmds, coords);
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, black_color);
vgSetPaint(fill, VG_FILL_PATH);
vgDrawPath(path, VG_FILL_PATH);
vgDestroyPath(path);
vgDestroyPaint(fill);
}
static void draw_marks(VGPath path)
{
VGfloat point[2], tangent[2];
int i = 0;
for (i = 0; i < 1300; i += 50) {
vgPointAlongPath(path, 0, 6, i,
point + 0, point + 1,
tangent + 0, tangent + 1);
draw_point(point[0], point[1]);
}
}
static void
init(void)
{
static const VGubyte cmds[6] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS,
VG_LINE_TO_ABS, VG_CLOSE_PATH};
static const VGfloat coords[] = { 0, 200,
300, 200,
50, 0,
150, 300,
250, 0};
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_ALL);
vgAppendPathData(path, 6, cmds, coords);
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, green_color);
vgSetPaint(fill, VG_FILL_PATH);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
VGfloat point[2], tangent[2];
int i = 0;
vgClear(0, 0, window_width(), window_height());
vgSetPaint(fill, VG_FILL_PATH);
vgDrawPath(path, VG_FILL_PATH);
draw_marks(path);
vgFlush();
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, 0);
}

View File

@@ -1,116 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <X11/keysym.h>
#include <stdio.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {0.4, 0.1, 1.0, 1.0};
VGPath path;
VGPaint fill;
VGint cap_style = VG_CAP_BUTT;
VGint join_style = VG_JOIN_MITER;
static void
init(void)
{
#if 0
static const VGubyte cmds[] = {VG_MOVE_TO_ABS,
VG_CUBIC_TO_ABS,
};
static const VGfloat coords[] = {30, 30, 264, 0, 0, 264, 234, 234
};
#else
static const VGubyte cmds[] = {VG_MOVE_TO_ABS,
VG_LINE_TO_ABS,
VG_LINE_TO_ABS
};
static const VGfloat coords[] = {30, 30, 202, 30, 150, 224
};
#endif
VGfloat dash_pattern[2] = { 20.f, 20.f };
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO);
vgAppendPathData(path, 3, cmds, coords);
fill = vgCreatePaint();
vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
vgSetPaint(fill, VG_FILL_PATH);
vgSetfv(VG_CLEAR_COLOR, 4, white_color);
vgSetf(VG_STROKE_LINE_WIDTH, 20);
vgSeti(VG_STROKE_CAP_STYLE, cap_style);
vgSeti(VG_STROKE_JOIN_STYLE, join_style);
vgSetfv(VG_STROKE_DASH_PATTERN, 2, dash_pattern);
vgSetf(VG_STROKE_DASH_PHASE, 0.0f);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_STROKE_PATH);
vgFlush();
}
static int key_press(unsigned key)
{
switch(key) {
case XK_c:
case XK_C:
++cap_style;
if (cap_style > VG_CAP_SQUARE)
cap_style = VG_CAP_BUTT;
switch(cap_style) {
case VG_CAP_BUTT:
fprintf(stderr, "Cap style 'butt'\n");
break;
case VG_CAP_ROUND:
fprintf(stderr, "Cap style 'round'\n");
break;
case VG_CAP_SQUARE:
fprintf(stderr, "Cap style 'square'\n");
break;
}
vgSeti(VG_STROKE_CAP_STYLE, cap_style);
break;
case XK_j:
case XK_J:
++join_style;
if (join_style > VG_JOIN_BEVEL)
join_style = VG_JOIN_MITER;
switch(join_style) {
case VG_JOIN_MITER:
fprintf(stderr, "Join style 'miter'\n");
break;
case VG_JOIN_ROUND:
fprintf(stderr, "Join style 'round'\n");
break;
case VG_JOIN_BEVEL:
fprintf(stderr, "Join style 'bevel'\n");
break;
}
vgSeti(VG_STROKE_JOIN_STYLE, join_style);
break;
default:
break;
}
return VG_TRUE;
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, key_press);
}

View File

@@ -1,207 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <X11/keysym.h>
#include <stdio.h>
VGPaint stroke;
VGPath target;
VGPath lines;
VGfloat xform[9];
VGfloat color1[4];
VGfloat color2[4];
VGfloat bgCol[4];
static void
init(void)
{
VGubyte lineCmds[6];
VGfloat lineCoords[8];
VGfloat arcCoords[5];
VGubyte sccCmd[1];
VGubyte scCmd[1];
VGubyte lccCmd[1];
VGubyte lcCmd[1];
VGubyte moveCmd[1];
VGfloat moveCoords[2];
VGint i;
bgCol[0] = 1.0f;
bgCol[1] = 1.0f;
bgCol[2] = 1.0f;
bgCol[3] = 1.0f;
vgSetfv(VG_CLEAR_COLOR, 4, bgCol);
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
stroke = vgCreatePaint();
/* Red */
color1[0] = 1.0f;
color1[1] = 0.0f;
color1[2] = 0.0f;
color1[3] = 1.0f;
/* Orange */
color2[0] = 1.0000f;
color2[1] = 1.0f;
color2[2] = 0.0f;
color2[3] = 1.0f;
vgSetPaint(stroke, VG_STROKE_PATH);
vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_SQUARE);
{
VGfloat temp[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
for (i = 0; i < 9; i++)
{
xform[i] = temp[i];
}
}
vgGetMatrix(xform);
target = vgCreatePath(VG_PATH_FORMAT_STANDARD,
VG_PATH_DATATYPE_F, 1, 0, 0, 0, VG_PATH_CAPABILITY_TRANSFORM_TO);
#if 0
/* Line path */
{
VGubyte temp[6] = {VG_MOVE_TO_ABS, VG_VLINE_TO_REL,
VG_MOVE_TO_ABS, VG_VLINE_TO_REL,
VG_HLINE_TO_REL, VG_VLINE_TO_REL};
for (i = 0; i < 6; i++)
{
lineCmds[i] = temp[i];
}
}
{
VGfloat temp[8] = {0.5f, 0.8f, -0.6f, 0.28f, 0.6f, -0.4f, 0.44f, 0.4f};
for (i = 0; i < 8; i++)
{
lineCoords[i] = temp[i] * window_width();
}
}
#else
{
VGfloat temp[5] = {0.35f, 0.15f, 29, 0.3f, 0.4f};
for (i = 0; i < 5; i++)
{
arcCoords[i] = temp[i] * window_width();
}
arcCoords[2] = 29;
}
{
VGubyte temp[1] = {VG_SCCWARC_TO_ABS};
for (i = 0; i < 1; i++)
{
sccCmd[i] = temp[i];
}
}
{
VGubyte temp[1] = {VG_SCWARC_TO_ABS};
for (i = 0; i < 1; i++)
{
scCmd[i] = temp[i];
}
}
{
VGubyte temp[1] = {VG_LCCWARC_TO_ABS};
for (i = 0; i < 1; i++)
{
lccCmd[i] = temp[i];
}
}
{
VGubyte temp[1] = {VG_LCWARC_TO_ABS};
for (i = 0; i < 1; i++)
{
lcCmd[i] = temp[i];
}
}
{
VGubyte temp[1] = {VG_MOVE_TO_ABS};
for (i = 0; i < 1; i++)
{
moveCmd[i] = temp[i];
}
}
{
VGfloat temp[2] = {0.7f, 0.6f};
for (i = 0; i < 2; i++)
{
moveCoords[i] = temp[i] * window_width();
}
}
#endif
lines = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1,
0, 0, 0,
VG_PATH_CAPABILITY_APPEND_TO|
VG_PATH_CAPABILITY_TRANSFORM_FROM);
#if 0
vgAppendPathData(lines, 6, lineCmds, lineCoords);
#else
vgAppendPathData(lines, 1, moveCmd, moveCoords);
vgAppendPathData(lines, 1, sccCmd, arcCoords);
vgAppendPathData(lines, 1, moveCmd, moveCoords);
vgAppendPathData(lines, 1, scCmd, arcCoords);
vgAppendPathData(lines, 1, moveCmd, moveCoords);
vgAppendPathData(lines, 1, lccCmd, arcCoords);
vgAppendPathData(lines, 1, moveCmd, moveCoords);
vgAppendPathData(lines, 1, lcCmd, arcCoords);
#endif
vgLoadIdentity();
vgTranslate(0.25f * window_width(), 0.25f * window_height());
vgRotate(30);
vgTranslate(-0.25f * window_width(), -0.25f * window_height());
vgTransformPath(target, lines);}
/* new window size or exposure */
static void
reshape(int w, int h)
{
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgLoadMatrix(xform);
vgLoadIdentity();
vgTranslate(0.25f * window_width(), 0.25f * window_height());
vgRotate(30);
vgTranslate(-0.25f * window_width(), -0.25f * window_height());
vgSetf(VG_STROKE_LINE_WIDTH, 7);
vgSetParameterfv(stroke, VG_PAINT_COLOR, 4, color1);
vgDrawPath(lines, VG_STROKE_PATH);
vgLoadMatrix(xform);
vgSetParameterfv(stroke, VG_PAINT_COLOR, 4, color2);
vgSetf(VG_STROKE_LINE_WIDTH, 3);
vgDrawPath(target, VG_STROKE_PATH);
}
static int key_press(unsigned key)
{
switch(key) {
case XK_c:
case XK_C:
break;
case XK_j:
case XK_J:
break;
default:
break;
}
return VG_TRUE;
}
int main(int argc, char **argv)
{
return run(argc, argv, init, reshape,
draw, key_press);
}

View File

@@ -1,74 +0,0 @@
#include "eglcommon.h"
#include <VG/openvg.h>
#include <VG/vgu.h>
const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
const VGfloat color[4] = {0.4, 0.1, 1.0, 1.0};
VGPath path;
VGPaint paint;
static void
init(void)
{
VGfloat clearColor[] = {0.0f, 0.0f, 0.0f, 1.0f};/* black color */
VGfloat greenColor[] = {0.0f, 1.0f, 0.0f, 1.0f};/* green color */
VGint arcType = VGU_ARC_OPEN;
VGfloat x, y, w, h, startAngle, angleExtent;
x = 150;
y = 150;
w = 150;
h = 150;
#if 0
startAngle = -540.0f;
angleExtent = 270.0f;
#else
startAngle = 270.0f;
angleExtent = 90.0f;
#endif
paint = vgCreatePaint();
vgSetPaint(paint, VG_STROKE_PATH);
vgSetParameterfv(paint, VG_PAINT_COLOR, 4, greenColor);
vgSetParameteri( paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgSetf(VG_STROKE_LINE_WIDTH, 6.0f);
vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
vguArc(path, x, y, w, h, startAngle, angleExtent, arcType);
vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_BEVEL);
vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);
}
/* new window size or exposure */
static void
reshape(int w, int h)
{
vgLoadIdentity();
}
static void
draw(void)
{
vgClear(0, 0, window_width(), window_height());
vgDrawPath(path, VG_STROKE_PATH);
vgFlush();
}
int main(int argc, char **argv)
{
// set_window_size(64, 63);
return run(argc, argv, init, reshape,
draw, 0);
}

10
progs/perf/.gitignore vendored
View File

@@ -1,10 +0,0 @@
copytex
drawoverhead
fbobind
fill
genmipmap
readpixels
swapbuffers
teximage
vbo
vertexrate

View File

@@ -1,55 +0,0 @@
# progs/demos/Makefile
TOP = ../..
include $(TOP)/configs/current
INCDIR = $(TOP)/include
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) \
-l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
# using : to avoid APP_CC pointing to CC loop
CC := $(APP_CC)
CFLAGS := -I$(INCDIR) $(CFLAGS)
LDLIBS = $(LIBS)
PROG_SOURCES = \
copytex.c \
drawoverhead.c \
fbobind.c \
fill.c \
genmipmap.c \
readpixels.c \
swapbuffers.c \
teximage.c \
vbo.c \
vertexrate.c \
PROG_OBJS = $(PROG_SOURCES:.c=.o)
PROGS = $(PROG_SOURCES:%.c=%)
UTIL_SOURCES = \
common.c \
glmain.c
UTIL_HEADERS = \
common.h \
glmain.h
UTIL_OBJS = $(UTIL_SOURCES:.c=.o)
default: $(PROGS)
$(PROG_OBJS): $(UTIL_HEADERS)
$(PROGS): $(UTIL_OBJS)
clean:
-rm -f $(PROGS)
-rm -f *.o *~

View File

@@ -1,32 +0,0 @@
Import('env')
if not env['GLUT']:
Return()
env = env.Clone()
env.Prepend(LIBS = ['$GLUT_LIB'])
progs = [
'copytex',
'drawoverhead',
'fbobind',
'fill',
'genmipmap',
'readpixels',
'swapbuffers',
'teximage',
'vbo',
'vertexrate',
]
for prog in progs:
env.Program(
target = prog,
source = [
prog + '.c',
'common.c',
'glmain.c',
]
)

View File

@@ -1,137 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Common perf code. This should be re-usable with other APIs.
*/
#include "common.h"
#include "glmain.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#if defined(_MSC_VER)
#define snprintf _snprintf
#endif
/* Need to add a fflush windows console with mingw, otherwise nothing
* shows up until program exit. May want to add logging here.
*/
void
perf_printf(const char *format, ...)
{
va_list ap;
va_start(ap, format);
fflush(stdout);
vfprintf(stdout, format, ap);
fflush(stdout);
va_end(ap);
}
/**
* Run function 'f' for enough iterations to reach a steady state.
* Return the rate (iterations/second).
*/
double
PerfMeasureRate(PerfRateFunc f)
{
const double minDuration = 1.0;
double rate = 0.0, prevRate = 0.0;
unsigned subiters;
/* Compute initial number of iterations to try.
* If the test function is pretty slow this helps to avoid
* extraordarily long run times.
*/
subiters = 2;
{
const double t0 = PerfGetTime();
double t1;
do {
f(subiters); /* call the rendering function */
t1 = PerfGetTime();
subiters *= 2;
} while (t1 - t0 < 0.1 * minDuration);
}
/*perf_printf("initial subIters = %u\n", subiters);*/
while (1) {
const double t0 = PerfGetTime();
unsigned iters = 0;
double t1;
do {
f(subiters); /* call the rendering function */
t1 = PerfGetTime();
iters += subiters;
} while (t1 - t0 < minDuration);
rate = iters / (t1 - t0);
if (0)
perf_printf("prevRate %f rate %f ratio %f iters %u\n",
prevRate, rate, rate/prevRate, iters);
/* Try and speed the search up by skipping a few steps:
*/
if (rate > prevRate * 1.6)
subiters *= 8;
else if (rate > prevRate * 1.2)
subiters *= 4;
else if (rate > prevRate * 1.05)
subiters *= 2;
else
break;
prevRate = rate;
}
if (0)
perf_printf("%s returning iters %u rate %f\n", __FUNCTION__, subiters, rate);
return rate;
}
/* Note static buffer, can only use once per printf.
*/
const char *
PerfHumanFloat( double d )
{
static char buf[80];
if (d > 1000000000.0)
snprintf(buf, sizeof(buf), "%.1f billion", d / 1000000000.0);
else if (d > 1000000.0)
snprintf(buf, sizeof(buf), "%.1f million", d / 1000000.0);
else if (d > 1000.0)
snprintf(buf, sizeof(buf), "%.1f thousand", d / 1000.0);
else
snprintf(buf, sizeof(buf), "%.1f", d);
return buf;
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef COMMON_H
#define COMMON_H
#include <stddef.h> /* for offsetof() */
typedef void (*PerfRateFunc)(unsigned count);
extern double
PerfMeasureRate(PerfRateFunc f);
const char *
PerfHumanFloat( double d );
extern void
perf_printf(const char *format, ...);
#endif /* COMMON_H */

View File

@@ -1,214 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Measure glCopyTex[Sub]Image() rate.
* Create a large, off-screen framebuffer object for rendering and
* copying the texture data from it since we can't make really large
* on-screen windows.
*
* Brian Paul
* 22 Sep 2009
*/
#include <string.h>
#include "glmain.h"
#include "common.h"
int WinWidth = 100, WinHeight = 100;
static GLuint VBO, FBO, RBO, Tex;
const GLsizei MinSize = 16, MaxSize = 4096;
static GLsizei TexSize;
static const GLboolean DrawPoint = GL_TRUE;
static const GLboolean TexSubImage4 = GL_FALSE;
struct vertex
{
GLfloat x, y, s, t;
};
static const struct vertex vertices[1] = {
{ 0.0, 0.0, 0.5, 0.5 },
};
#define VOFFSET(F) ((void *) offsetof(struct vertex, F))
/** Called from test harness/main */
void
PerfInit(void)
{
const GLenum filter = GL_LINEAR;
GLenum stat;
if (!PerfExtensionSupported("GL_EXT_framebuffer_object")) {
perf_printf("copytex: GL_EXT_framebuffer_object not supported\n");
exit(0);
}
/* setup VBO */
glGenBuffersARB(1, &VBO);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertices),
vertices, GL_STATIC_DRAW_ARB);
glVertexPointer(2, GL_FLOAT, sizeof(struct vertex), VOFFSET(x));
glTexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), VOFFSET(s));
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
/* setup texture */
glGenTextures(1, &Tex);
glBindTexture(GL_TEXTURE_2D, Tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
glEnable(GL_TEXTURE_2D);
/* setup rbo */
glGenRenderbuffersEXT(1, &RBO);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, RBO);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA, MaxSize, MaxSize);
/* setup fbo */
glGenFramebuffersEXT(1, &FBO);
glBindFramebufferEXT(GL_FRAMEBUFFER, FBO);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, RBO);
stat = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (stat != GL_FRAMEBUFFER_COMPLETE_EXT) {
perf_printf("fboswitch: Error: incomplete FBO!\n");
exit(1);
}
/* clear the FBO */
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glViewport(0, 0, MaxSize, MaxSize);
glClear(GL_COLOR_BUFFER_BIT);
}
static void
CopyTexImage(unsigned count)
{
unsigned i;
for (i = 1; i < count; i++) {
/* draw something */
if (DrawPoint)
glDrawArrays(GL_POINTS, 0, 1);
/* copy whole texture */
glCopyTexImage2D(GL_TEXTURE_2D, 0,
GL_RGBA, 0, 0, TexSize, TexSize, 0);
}
glFinish();
}
static void
CopyTexSubImage(unsigned count)
{
unsigned i;
for (i = 1; i < count; i++) {
/* draw something */
if (DrawPoint)
glDrawArrays(GL_POINTS, 0, 1);
/* copy sub texture */
if (TexSubImage4) {
/* four sub-copies */
GLsizei half = TexSize / 2;
/* lower-left */
glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
0, 0, 0, 0, half, half);
/* lower-right */
glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
half, 0, half, 0, half, half);
/* upper-left */
glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
0, half, 0, half, half, half);
/* upper-right */
glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
half, half, half, half, half, half);
}
else {
/* one big copy */
glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
0, 0, 0, 0, TexSize, TexSize);
}
}
glFinish();
}
/** Called from test harness/main */
void
PerfNextRound(void)
{
}
/** Called from test harness/main */
void
PerfDraw(void)
{
double rate, mbPerSec;
GLint sub, maxTexSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
/* loop over whole/sub tex copy */
for (sub = 0; sub < 2; sub++) {
/* loop over texture sizes */
for (TexSize = MinSize; TexSize <= MaxSize; TexSize *= 4) {
if (TexSize <= maxTexSize) {
GLint bytesPerImage = 4 * TexSize * TexSize;
if (sub == 0)
rate = PerfMeasureRate(CopyTexImage);
else {
/* setup empty dest texture */
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
TexSize, TexSize, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
rate = PerfMeasureRate(CopyTexSubImage);
}
mbPerSec = rate * bytesPerImage / (1024.0 * 1024.0);
}
else {
rate = 0.0;
mbPerSec = 0.0;
}
perf_printf(" glCopyTex%sImage(%d x %d): %.1f copies/sec, %.1f Mpixels/sec\n",
(sub ? "Sub" : ""), TexSize, TexSize, rate, mbPerSec);
}
}
exit(0);
}

View File

@@ -1,137 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Measure drawing overhead
*
* This is the first in a series of simple performance benchmarks.
* The code in this file should be as simple as possible to make it
* easily portable to other APIs.
*
* All the window-system stuff should be contained in glmain.c (or TBDmain.c).
*
* Brian Paul
* 15 Sep 2009
*/
#include "glmain.h"
#include "common.h"
int WinWidth = 100, WinHeight = 100;
static GLuint VBO;
struct vertex
{
GLfloat x, y;
};
static const struct vertex vertices[4] = {
{ -1.0, -1.0 },
{ 1.0, -1.0 },
{ 1.0, 1.0 },
{ -1.0, 1.0 }
};
/** Called from test harness/main */
void
PerfInit(void)
{
/* setup VBO w/ vertex data */
glGenBuffersARB(1, &VBO);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
glBufferDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(vertices), vertices, GL_STATIC_DRAW_ARB);
glVertexPointer(2, GL_FLOAT, sizeof(struct vertex), (void *) 0);
glEnableClientState(GL_VERTEX_ARRAY);
/* misc GL state */
glAlphaFunc(GL_ALWAYS, 0.0);
}
static void
DrawNoStateChange(unsigned count)
{
unsigned i;
for (i = 0; i < count; i++) {
glDrawArrays(GL_POINTS, 0, 4);
}
glFinish();
}
static void
DrawNopStateChange(unsigned count)
{
unsigned i;
for (i = 0; i < count; i++) {
glDisable(GL_ALPHA_TEST);
glDrawArrays(GL_POINTS, 0, 4);
}
glFinish();
}
static void
DrawStateChange(unsigned count)
{
unsigned i;
for (i = 0; i < count; i++) {
if (i & 1)
glEnable(GL_TEXTURE_GEN_S);
else
glDisable(GL_TEXTURE_GEN_S);
glDrawArrays(GL_POINTS, 0, 4);
}
glFinish();
}
void
PerfNextRound(void)
{
}
/** Called from test harness/main */
void
PerfDraw(void)
{
double rate0, rate1, rate2, overhead;
rate0 = PerfMeasureRate(DrawNoStateChange);
perf_printf(" Draw only: %s draws/second\n",
PerfHumanFloat(rate0));
rate1 = PerfMeasureRate(DrawNopStateChange);
overhead = 1000.0 * (1.0 / rate1 - 1.0 / rate0);
perf_printf(" Draw w/ nop state change: %s draws/sec (overhead: %f ms/draw)\n",
PerfHumanFloat(rate1), overhead);
rate2 = PerfMeasureRate(DrawStateChange);
overhead = 1000.0 * (1.0 / rate2 - 1.0 / rate0);
perf_printf(" Draw w/ state change: %s draws/sec (overhead: %f ms/draw)\n",
PerfHumanFloat(rate2), overhead);
exit(0);
}

View File

@@ -1,153 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Measure rate of binding/switching between FBO targets.
* Create two framebuffer objects for rendering to two textures.
* Ping pong between texturing from one and drawing into the other.
*
* Brian Paul
* 22 Sep 2009
*/
#include <string.h>
#include "glmain.h"
#include "common.h"
int WinWidth = 100, WinHeight = 100;
static GLuint VBO;
static GLuint FBO[2], Tex[2];
static const GLsizei TexSize = 512;
static const GLboolean DrawPoint = GL_TRUE;
struct vertex
{
GLfloat x, y, s, t;
};
static const struct vertex vertices[1] = {
{ 0.0, 0.0, 0.5, 0.5 },
};
#define VOFFSET(F) ((void *) offsetof(struct vertex, F))
/** Called from test harness/main */
void
PerfInit(void)
{
const GLenum filter = GL_LINEAR;
GLenum stat;
int i;
if (!PerfExtensionSupported("GL_EXT_framebuffer_object")) {
perf_printf("fboswitch: GL_EXT_framebuffer_object not supported\n");
exit(0);
}
/* setup VBO */
glGenBuffersARB(1, &VBO);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertices),
vertices, GL_STATIC_DRAW_ARB);
glVertexPointer(2, GL_FLOAT, sizeof(struct vertex), VOFFSET(x));
glTexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), VOFFSET(s));
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glGenFramebuffersEXT(2, FBO);
glGenTextures(2, Tex);
for (i = 0; i < 2; i++) {
/* setup texture */
glBindTexture(GL_TEXTURE_2D, Tex[i]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
TexSize, TexSize, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
/* setup fbo */
glBindFramebufferEXT(GL_FRAMEBUFFER, FBO[i]);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, Tex[i], 0/*level*/);
stat = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (stat != GL_FRAMEBUFFER_COMPLETE_EXT) {
perf_printf("fboswitch: Error: incomplete FBO!\n");
exit(1);
}
/* clear the FBO */
glClear(GL_COLOR_BUFFER_BIT);
}
glEnable(GL_TEXTURE_2D);
}
static void
FBOBind(unsigned count)
{
unsigned i;
for (i = 1; i < count; i++) {
const GLuint dst = i & 1;
const GLuint src = 1 - dst;
/* bind src texture */
glBindTexture(GL_TEXTURE_2D, Tex[src]);
/* bind dst fbo */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBO[dst]);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
/* draw something */
if (DrawPoint)
glDrawArrays(GL_POINTS, 0, 1);
}
glFinish();
}
/** Called from test harness/main */
void
PerfNextRound(void)
{
}
/** Called from test harness/main */
void
PerfDraw(void)
{
double rate;
rate = PerfMeasureRate(FBOBind);
perf_printf(" FBO Binding: %1.f binds/sec\n", rate);
exit(0);
}

View File

@@ -1,248 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Measure fill rates.
*
* Brian Paul
* 21 Sep 2009
*/
#include "glmain.h"
#include "common.h"
int WinWidth = 1000, WinHeight = 1000;
static GLuint VBO, TexObj;
struct vertex
{
GLfloat x, y, s, t, r, g, b, a;
};
#define VOFFSET(F) ((void *) offsetof(struct vertex, F))
static const struct vertex vertices[4] = {
/* x y s t r g b a */
{ -1.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.5 },
{ 1.0, -1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.5 },
{ 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.5 },
{ -1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.5 }
};
static const char *VertexShader =
"void main() \n"
"{ \n"
" gl_Position = ftransform(); \n"
" gl_TexCoord[0] = gl_MultiTexCoord0; \n"
" gl_FrontColor = gl_Color; \n"
"} \n";
/* simple fragment shader */
static const char *FragmentShader1 =
"uniform sampler2D Tex; \n"
"void main() \n"
"{ \n"
" vec4 t = texture2D(Tex, gl_TexCoord[0].xy); \n"
" gl_FragColor = vec4(1.0) - t * gl_Color; \n"
"} \n";
/**
* A more complex fragment shader (but equivalent to first shader).
* A good optimizer should catch some of these no-op operations, but
* probably not all of them.
*/
static const char *FragmentShader2 =
"uniform sampler2D Tex; \n"
"void main() \n"
"{ \n"
" // as above \n"
" vec4 t = texture2D(Tex, gl_TexCoord[0].xy); \n"
" t = vec4(1.0) - t * gl_Color; \n"
" vec4 u; \n"
" // no-op negate/swizzle \n"
" u = -t.wzyx; \n"
" t = -u.wzyx; \n"
" // no-op inverts \n"
" t = vec4(1.0) - t; \n"
" t = vec4(1.0) - t; \n"
" // no-op min/max \n"
" t = min(t, t); \n"
" t = max(t, t); \n"
" // no-op moves \n"
" u = t; \n"
" t = u; \n"
" u = t; \n"
" t = u; \n"
" // no-op add/mul \n"
" t = (t + t + t + t) * 0.25; \n"
" // no-op mul/sub \n"
" t = 3.0 * t - 2.0 * t; \n"
" // no-op negate/min/max \n"
" t = -min(-t, -t); \n"
" t = -max(-t, -t); \n"
" gl_FragColor = t; \n"
"} \n";
static GLuint ShaderProg1, ShaderProg2;
/** Called from test harness/main */
void
PerfInit(void)
{
GLint u;
/* setup VBO w/ vertex data */
glGenBuffersARB(1, &VBO);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
glBufferDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(vertices), vertices, GL_STATIC_DRAW_ARB);
glVertexPointer(2, GL_FLOAT, sizeof(struct vertex), VOFFSET(x));
glTexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), VOFFSET(s));
glColorPointer(4, GL_FLOAT, sizeof(struct vertex), VOFFSET(r));
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
/* setup texture */
TexObj = PerfCheckerTexture(128, 128);
/* setup shaders */
ShaderProg1 = PerfShaderProgram(VertexShader, FragmentShader1);
glUseProgram(ShaderProg1);
u = glGetUniformLocation(ShaderProg1, "Tex");
glUniform1i(u, 0); /* texture unit 0 */
ShaderProg2 = PerfShaderProgram(VertexShader, FragmentShader2);
glUseProgram(ShaderProg2);
u = glGetUniformLocation(ShaderProg2, "Tex");
glUniform1i(u, 0); /* texture unit 0 */
glUseProgram(0);
}
static void
Ortho(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
DrawQuad(unsigned count)
{
unsigned i;
glClear(GL_COLOR_BUFFER_BIT);
for (i = 0; i < count; i++) {
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
/* Avoid sending command buffers with huge numbers of fullscreen
* quads. Graphics schedulers don't always cope well with
* this...
*/
if (i % 128 == 0) {
PerfSwapBuffers();
glClear(GL_COLOR_BUFFER_BIT);
}
}
glFinish();
if (1)
PerfSwapBuffers();
}
void
PerfNextRound(void)
{
}
/** Called from test harness/main */
void
PerfDraw(void)
{
double rate;
double pixelsPerDraw = WinWidth * WinHeight;
Ortho();
/* simple fill */
rate = PerfMeasureRate(DrawQuad) * pixelsPerDraw;
perf_printf(" Simple fill: %s pixels/second\n",
PerfHumanFloat(rate));
/* blended fill */
glEnable(GL_BLEND);
rate = PerfMeasureRate(DrawQuad) * pixelsPerDraw;
glDisable(GL_BLEND);
perf_printf(" Blended fill: %s pixels/second\n",
PerfHumanFloat(rate));
/* textured fill */
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
rate = PerfMeasureRate(DrawQuad) * pixelsPerDraw;
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
perf_printf(" Textured fill: %s pixels/second\n",
PerfHumanFloat(rate));
/* shader1 fill */
glUseProgram(ShaderProg1);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
rate = PerfMeasureRate(DrawQuad) * pixelsPerDraw;
glUseProgram(0);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
perf_printf(" Shader1 fill: %s pixels/second\n",
PerfHumanFloat(rate));
/* shader2 fill */
glUseProgram(ShaderProg2);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
rate = PerfMeasureRate(DrawQuad) * pixelsPerDraw;
glUseProgram(0);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
perf_printf(" Shader2 fill: %s pixels/second\n",
PerfHumanFloat(rate));
exit(0);
}

View File

@@ -1,136 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Measure glGenerateMipmap() speed.
*
* Brian Paul
* 24 Sep 2009
*/
#include <string.h>
#include "glmain.h"
#include "common.h"
int WinWidth = 100, WinHeight = 100;
static GLboolean DrawPoint = GL_TRUE;
static GLuint VBO;
static GLuint TexObj = 0;
static GLint BaseLevel, MaxLevel;
struct vertex
{
GLfloat x, y, s, t;
};
static const struct vertex vertices[1] = {
{ 0.0, 0.0, 0.5, 0.5 },
};
#define VOFFSET(F) ((void *) offsetof(struct vertex, F))
/** Called from test harness/main */
void
PerfInit(void)
{
/* setup VBO w/ vertex data */
glGenBuffersARB(1, &VBO);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBO);
glBufferDataARB(GL_ARRAY_BUFFER_ARB,
sizeof(vertices), vertices, GL_STATIC_DRAW_ARB);
glVertexPointer(2, GL_FLOAT, sizeof(struct vertex), VOFFSET(x));
glTexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), VOFFSET(s));
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glGenTextures(1, &TexObj);
glBindTexture(GL_TEXTURE_2D, TexObj);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEnable(GL_TEXTURE_2D);
}
static void
GenMipmap(unsigned count)
{
unsigned i;
for (i = 0; i < count; i++) {
GLubyte texel[4];
texel[0] = texel[1] = texel[2] = texel[3] = i & 0xff;
/* dirty the base image */
glTexSubImage2D(GL_TEXTURE_2D, BaseLevel,
0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, texel);
glGenerateMipmap(GL_TEXTURE_2D);
if (DrawPoint)
glDrawArrays(GL_POINTS, 0, 1);
}
glFinish();
}
/** Called from test harness/main */
void
PerfNextRound(void)
{
}
/** Called from test harness/main */
void
PerfDraw(void)
{
const GLint NumLevels = 12;
const GLint TexWidth = 2048, TexHeight = 2048;
GLubyte *img;
double rate;
/* Make 2K x 2K texture */
img = (GLubyte *) malloc(TexWidth * TexHeight * 4);
memset(img, 128, TexWidth * TexHeight * 4);
glTexImage2D(GL_TEXTURE_2D, 0,
GL_RGBA, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, img);
free(img);
perf_printf("Texture level[0] size: %d x %d, %d levels\n",
TexWidth, TexHeight, NumLevels);
/* loop over base levels 0, 2, 4 */
for (BaseLevel = 0; BaseLevel <= 4; BaseLevel += 2) {
/* loop over max level */
for (MaxLevel = NumLevels; MaxLevel > BaseLevel; MaxLevel--) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
rate = PerfMeasureRate(GenMipmap);
perf_printf(" glGenerateMipmap(levels %d..%d): %.2f gens/sec\n",
BaseLevel + 1, MaxLevel, rate);
}
}
exit(0);
}

View File

@@ -1,268 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* OpenGL/GLUT common code for perf programs.
* Brian Paul
* 15 Sep 2009
*/
#include <stdio.h>
#include "glmain.h"
#include <GL/glut.h>
static int Win;
static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
/** Return time in seconds */
double
PerfGetTime(void)
{
return glutGet(GLUT_ELAPSED_TIME) * 0.001;
}
void
PerfSwapBuffers(void)
{
glutSwapBuffers();
}
/** make simple checkerboard texture object */
GLuint
PerfCheckerTexture(GLsizei width, GLsizei height)
{
const GLenum filter = GL_NEAREST;
GLubyte *img = (GLubyte *) malloc(width * height * 4);
GLint i, j, k;
GLuint obj;
k = 0;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
GLubyte color;
if (((i / 8) ^ (j / 8)) & 1) {
color = 0xff;
}
else {
color = 0x0;
}
img[k++] = color;
img[k++] = color;
img[k++] = color;
img[k++] = color;
}
}
glGenTextures(1, &obj);
glBindTexture(GL_TEXTURE_2D, obj);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, img);
free(img);
return obj;
}
static GLuint
CompileShader(GLenum type, const char *shader)
{
GLuint sh;
GLint stat;
sh = glCreateShader(type);
glShaderSource(sh, 1, (const GLchar **) &shader, NULL);
glCompileShader(sh);
glGetShaderiv(sh, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog(sh, 1000, &len, log);
fprintf(stderr, "Error: problem compiling shader: %s\n", log);
exit(1);
}
return sh;
}
/** Make shader program from given vert/frag shader text */
GLuint
PerfShaderProgram(const char *vertShader, const char *fragShader)
{
GLuint prog;
GLint stat;
{
const char *version = (const char *) glGetString(GL_VERSION);
if ((version[0] != '2' &&
version[0] != '3') || version[1] != '.') {
fprintf(stderr, "Error: GL version 2.x or better required\n");
exit(1);
}
}
prog = glCreateProgram();
if (vertShader) {
GLuint vs = CompileShader(GL_VERTEX_SHADER, vertShader);
glAttachShader(prog, vs);
}
if (fragShader) {
GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fragShader);
glAttachShader(prog, fs);
}
glLinkProgram(prog);
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Shader link error:\n%s\n", log);
exit(1);
}
return prog;
}
int
PerfReshapeWindow( unsigned w, unsigned h )
{
if (glutGet(GLUT_SCREEN_WIDTH) < w ||
glutGet(GLUT_SCREEN_HEIGHT) < h)
return 0;
glutReshapeWindow( w, h );
glutPostRedisplay();
return 1;
}
GLboolean
PerfExtensionSupported(const char *ext)
{
return glutExtensionSupported(ext);
}
static void
Idle(void)
{
PerfNextRound();
}
static void
Draw(void)
{
PerfDraw();
glutSwapBuffers();
}
static void
Reshape(int width, int height)
{
WinWidth = width;
WinHeight = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
}
static void
Key(unsigned char key, int x, int y)
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case 'z':
Zrot -= step;
break;
case 'Z':
Zrot += step;
break;
case 27:
glutDestroyWindow(Win);
exit(0);
break;
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot -= step;
break;
case GLUT_KEY_DOWN:
Xrot += step;
break;
case GLUT_KEY_LEFT:
Yrot -= step;
break;
case GLUT_KEY_RIGHT:
Yrot += step;
break;
}
glutPostRedisplay();
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Draw);
glutIdleFunc(Idle);
PerfInit();
glutMainLoop();
return 0;
}

View File

@@ -1,68 +0,0 @@
/*
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VMWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef GLMAIN_H
#define GLMAIN_H
#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <stdlib.h>
#include <math.h>
/** Test programs can use these vars/functions */
extern int WinWidth, WinHeight;
extern double
PerfGetTime(void);
extern void
PerfSwapBuffers(void);
extern GLuint
PerfCheckerTexture(GLsizei width, GLsizei height);
extern GLuint
PerfShaderProgram(const char *vertShader, const char *fragShader);
extern int
PerfReshapeWindow( unsigned w, unsigned h );
extern GLboolean
PerfExtensionSupported(const char *ext);
/** Test programs must implement these functions **/
extern void
PerfInit(void);
extern void
PerfNextRound(void);
extern void
PerfDraw(void);
#endif /* GLMAIN_H */

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