Yep, I added support for pixel/vertex shaders. In this image a single shader has been assigned to the sprite. And in this shader there are 3 techniques, one for grayscale, one for 2-bit color and another for a sharpened image. Seems to run pretty good, getting ~240 FPS for 1000 sprites. This was my first stab at using shaders.
I thought that perhaps there would be no place for shaders in the 2D library, but I can see now I was mistaken. For post processing you can't beat it. Sadly my math being what it is (i.e. pathetic) my skill doesn't match my imagination for utilizing pixel shaders to their full potential. If anyone has any resources/links for learning how to do specific effects I'd much appreciate them.
I definitely can see why people are so crazy about these things though.
Fucking video cards.
OK, so I ran this on my machine at the office. It has a crappy Intel 82865G chipset, no T&L, no speed, no anything worthwhile... anyway:
Here's how the GUI window looks on my machine
Beautiful no? Makes me want to weep.
This is how it looks on an Intel 82865G shitset
The caption bar is a 1x24 pixel image that is stretched to meet up with the corners (I think it's around 300 pixels). Great, works fine on my GeForce 6600GT. Fucking Intel. Now I KNOW what you're thinking: "You didn't offset it by 0.5 you fucking idiot, you're worthless, go back to eating paint chips you ... " and so forth. But no! Here's my code for generating my texture coordinates:
/// Function to update the source image positioning.
protected override void UpdateImageLayer()
float tu; // Starting horizontal position.
float tv; // Starting vertical position.
float sizetu; // Width.
float sizetv; // Height.
if (_image == null)
// Initialize texture coordinates.
tu = (_imagePosition.X + 0.5f) / Image.ActualWidth;
tv = (_imagePosition.Y + 0.5f) / Image.ActualHeight;
sizetu = (_imagePosition.X + _size.X) / Image.ActualWidth;
sizetv = (_imagePosition.Y + _size.Y) / Image.ActualHeight;
_vertices.TextureCoordinates = new Vector2D(tu, tv);
_vertices.TextureCoordinates = new Vector2D(sizetu, tv);
_vertices.TextureCoordinates = new Vector2D(sizetu, sizetv);
_vertices.TextureCoordinates = new Vector2D(tu, sizetv);
Notice, shifting by 0.5. Why did I go on and on about that? Because I'm sure someone's going to ask about it, and even if I say I did it, they won't read it. Hopefully this will fix that.
ANYWAY. Why the hell is this happening? Is there some way to determine if the offset needs fixing on particular cards? Can explain this, should I just live with it, or should I go insane and start killing?