Friday, January 23

On bogus threat levels...

I fly every few weeks now and for the last who knows how long the threat level has been orange which supposedly represents a "high" threat of a terrorist attack.

to which Steve Mirsky in his regular column in Scientific American has this great retort:

Here’s how you know that the terrorist threat isn’t really high: the airport is still open, and your flight hasn’t been canceled.

Read the whole column here

Thursday, January 8

Multi-texture support for pyglet vertex lists

I wrote this little hack to allow easy expression of multiple sets of texture coordinates in pyglet vertex lists. I wrote it so I could use the texture splatting technique to draw a terrain map for a game. For that purpose it works very well. It does a small bit of monkey-patching to pyglet itself, so it may break if things are refactored, but it works good for 1.1.x.

To use it, you instantiate your vertex list the normal way except you can specify multiple sets of texture coordinates. Then you call multitexture.enable() passing it your new vertex list. Here's a simple example:

vl = pyglet.graphics.vertex_list(4,
('v2f', (100, 100, 200, 100, 200, 200, 100, 200)),
('t2f', (0, 0, 1, 0, 1, 1, 0, 1)),
('t2f', (0, 0, 0.25, 0, 0.25, 0.25, 0, 0.25)),
)
multitexture.enable(vl)

You can get the module here.

Labels: