Hi Rene,

Yvonne Jung wrote:
> if I remember right, Dirk should still have some code for this on his
> computer. Perhaps you can ask him.
>   
yes and no. I have versions for OpenGL and instantReality, but not for 
OpenSG right now.

The basic idea is to not use stencil but a shader instead. I would just 
create two FBOViewports that render into 2 textures. On those you can 
use the standard stereo decorator. The actual display viewport just has 
a PolygonForeground that interlaces the two images using a simple shader 
like the following:

const GLchar *vshader_source="\n\
void main()\n\
{\n\
  gl_TexCoord[0]= gl_MultiTexCoord0;\n\
  gl_TexCoord[1]= gl_MultiTexCoord1;\n\
  gl_Position=ftransform();\n\
}";

const GLchar *fshader_source="\n\
uniform sampler2D left_eye,right_eye;\n\
\n\
void main()\n\
{\n\
  vec4 color;\n\
  \n\
  float x =  gl_TexCoord[1].t - floor(gl_TexCoord[1].t);\n\
  \n\
  if ( x < 0.5) color = texture2D(right_eye,gl_TexCoord[0].st).rgba;\n\
  else          color = texture2D(left_eye ,gl_TexCoord[0].st).rgba;\n\
\n\
\n\
  gl_FragColor = color;\n\
}";

It uses the regular 0..1 texcoords in unit 0 and the window/pixel 
coordinate sin 1. You can probably replace that by setting uniforms with 
the window size and multiplying by the 0..1 coords to make it fit into a 
PolygonForeground.

Hope it helps

    Dirk


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to