Es gibt ein Open-Source Projekt für Anaglyph bei ATi, ich weiß aber nicht ob es echtes Anaglyph ist oder nur Fake, also ob es wirklich aus zwei Perspektiven berechnet oder einfach nur ein Bild berechnet und es versetzt nochmal overlaid.
Code:
shader leftPixelShader =
"!!ARBfp1.0
# 3D Glasses by Junkguy
# junkguy@canada.com
# Mar 7, 2004
# Bugfix by Wolfgang Keller
# Jan 26, 2005
TEMP pixel;
TEMP newLoc;
OUTPUT oColor = result.color;
PARAM scale = {-0.005, 0.0, 1.0, 1.0};
PARAM wk = {0.0, 0.0, 0.0, 0.0};
SUB newLoc, fragment.texcoord[0], scale;
TEX pixel, newLoc, texture[0], 2D;
MOV oColor.gb, pixel;
MOV oColor.r, wk;
END";
shader rightPixelShader =
"!!ARBfp1.0
TEMP pixel;
TEMP newLoc;
OUTPUT oColor = result.color;
PARAM scale = {0.005, 0.0, 1.0, 1.0};
PARAM wk = {0.0, 0.0, 0.0, 0.0};
SUB newLoc, fragment.texcoord[0], scale;
TEX pixel, newLoc, texture[0], 2D;
MOV oColor.r, pixel;
MOV oColor.gb, wk;
END";
shader combinePixelShader =
"!!ARBfp1.0
TEMP pixel1;
TEMP pixel2;
OUTPUT oColor = result.color;
TEX pixel1, fragment.texcoord[0], texture[0], 2D;
TEX pixel2, fragment.texcoord[0], texture[1], 2D;
ADD oColor, pixel1, pixel2;
END";
surface lefttemp = allocsurf(width, height);
texture[0].source = backbuffer;
destination lefttemp;
apply leftPixelShader;
surface righttemp = allocsurf(width, height);
texture[0].source = backbuffer;
destination righttemp;
apply rightPixelShader;
texture[0].source = lefttemp;
texture[1].source = righttemp;
destination backbuffer;
apply combinePixelShader;
EDIT: Ist ein Fake *grml*. Bei nahen Objekten ist das linke Bild genauso weit vom rechten entfernt wie bei weit entfernten Objekten.