Hi,

We have an OSG-based application that uses a 3rd party library to draw video.  
We want my application to perform a "digital zoom" on this video.  Given the 
API to this library, we wrote an OSG node with a draw callback that calculates 
the viewport for the video to draw in, and lets the library do its magic.

My theory for the "digital zoom" feature is to give the library a larger 
viewport (it always draws the same scene into the viewport) and 
cull/clip/stencil the result.  My current attempt is in using a glStencil in 
the draw callback as follows:


Code:
glEnable(GL_STENCIL_TEST);
glClear(GL_STENCIL_BUFFER_BIT);
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glBegin(GL_QUADS);
glVertex2d(left, bottom);
glVertex2d(left, top);
glVertex2d(right, top);
glVertex2d(right, bottom);
glEnd();
glStencilFunc(GL_EQUAL, 1, 1);
<draw video>
glDisable(GL_STENCIL_TEST);



Unfortunately, the video ends up disappearing entirely.  If I remove the 
Code:
glEnable(GL_STENCIL_TEST); 

 line, the video draws in the larger viewport and overlaps areas that it 
shouldn't.

Can anyone identify a flaw in my code?  Is there another approach that may be 
better?

Thank you!
-Doug[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=46318#46318





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to