Hi Robert, thanks for merging. The GL_STENCIL_TEST_TWO_SIDE issue:
OpenGL 2.0 has its own functions glStencil[Func|Op|Mask]Separate that handles both sides of polygon. -> GL_STENCIL_TEST_TWO_SIDE mode should not be set as OpenGL errors may follow (GL_STENCIL_TEST_TWO_SIDE is not a part of OpenGL 2.0 specification)
When using GL_EXT_stencil_two_side, GL_STENCIL_TEST_TWO_SIDE should be set to activate two sided stenciling.
When using GL_ATI_separate_stencil, GL_STENCIL_TEST_TWO_SIDE should not be set as OpenGL errors will probably follow. (This extension is not completed yet, but it will be trivial once GL_STENCIL_TEST_TWO_SIDE issue is resolved.)
Now, the problem: Using StencilTwoSided::getModeUsage method for setting GL_STENCIL_TEST_TWO_SIDE seems inappropriate as there is no context in cull phase to choose which of the three options will be used (ATI/NVIDIA/OpenGL20). Putting glEnable(GL_STENCIL_TEST_TWO_SIDE) in StencilTwoSided::apply means that it will be activated for the rest of the life of the application (e.g. there will be no glDisable afterwards), resulting in garbage for applications that mix standard stenciling and two sided stenciling.
The issue is above my current OSG knowledge. If needed, feel free to ask more details. John Robert Osfield wrote:
H Jan, I've merged your changes as-is, save for a few minor tweaks to formating and case of header include. The change to GL_STENCIL_TEST_TWO_SIDE is problematic though. I'm not familiar with the specifics of the various extensions so perhaps you can point me in the right direction. i.e what mode is used to toggle two sided stencil under ATI, Nvidia and GL2 respectively? Robert. On Fri, Aug 20, 2010 at 8:30 AM, PCJohn <[email protected]> wrote:Hi Robert, please, find attached improved Stencil and StencilTwoSided classes. Goals: - to handle INCR_WRAP values nicely if not supported by OpenGL (old hardware) - to support two side stenciling of OpenGL 2.0. Current implementation does not work on ATI as it uses Nvidia extension. Ready for commit: - Stencil and Stencil.cpp - please, review them Ready with "hack": - StencilTwoSided.cpp: please, see the line 113 in apply(): glEnable(GL_STENCIL_TEST_TWO_SIDE); This line used to be in getModeUsage() as usage.usesMode(GL_STENCIL_TEST_TWO_SIDE); but it produces OpenGL errors on ATI as it is unknown value there (it is Nvidia extension). Problems with my "glEnable" solution: - it enables two side stenciling forever, and it will disturb any other single-side stenciling in the scene graph. How to enable GL_STENCIL_TEST_TWO_SIDE properly only when Nvidia extension is going to be used? I am puzzled with the solution. Please, advice. The only solution I considered is to split implementation to two classes. But at the end, we may finish with four classes: one for one-side stencil, second for Nvidia extension, third for ATI extension and fourth for OpenGL 2.0. Maybe, just three classes, but only two would be nice... Please, advice. Looking forward for good OSG stenciling... John _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
