Hi,
I have a problem of translating some native OpenGL code into OpenSG
jargon.
Can anyone give me some hints how I should represent the following
OpenGL code into OpenSG primitves? Additionally, am I going to have
problems, if I later on try to do some shadowing of my scene, because of
using the stencil buffer? Can I save the current stencil buffer for the
duration of my special task and restore it later after I have finished
with it?
To shed some light on the code below. It adds some caps to the clipped
geometry in order to visualize solid geometry.
drawClipPlaneGeom(int idx)
{
// draw quad with clip plane number 'idx' its orientation ...
}
drawGeometry()
{
// some solid geometry
}
unsigned int cpId[] = {GL_CLIP_PLANE0, GL_CLIP_PLANE1, ...,
GL_CLIP_PLANE5};
void redraw()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);
for (int i = 0; i < 6; ++i) {
glClear(GL_STENCIL_BUFFER_BIT);
glStencilFunc(GL_NEVER, 1, 1);
glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT);
glEnable( cpId[i] );
drawGeometry();
glDisable( cpId[i] );
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_ZERO, GL_ZERO);
for (int j = 0; j < 6; ++j)
if (i != j) glEnable( cpId[j] );
drawClipPlaneGeom( i );
for (int j = 0; j < 6; ++j)
if (i != j) glDisable( cpId[j] );
}
glDisable(GL_STENCIL_TEST);
for (int i = 0; i < 6; ++i)
glEnable( cpId[i] );
drawGeometry();
for (int i = 0; i < 6; ++i)
glDisable( cpId[i] );
glutSwapBuffers();
}
Sorry, for bothering with these beginner questions, but I need some
activation impetus.
With best regards,
Johannes
____________
Virus checked by G DATA AntiVirusKit
Version: AVK 18.4802 from 06.08.2008
Virus news: www.antiviruslab.com
-------------------------------------------------------------------------
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