Hi,
before going into the details of the problem, I'd like to explain what
I'm trying to do and what I have done until now.
I have a 3rd-party function/method which is out of my scope. It seems to
read and write the window-system provided framebuffer and
manipulates/distorts the image. The first implementation was through
calling this function in a postdraw-callback. Everything works fine this
way.
Unfortunately this is not possible if the CHECKBOARD flag is set because
the postdraw-callback is called after the complete frame (including the
stenceling for the checkerboard) is rendered. The function would distort
the checkerboard. Hence, I have to apply this function for each "eye"
separately.
This seems possible with some changes to OSG itself but it also would
break the possibilty to upgrade later. So I decided to take another
approach:
I've tried rendering to an FBO (RTT, similar to osgprerender) but I
can't apply the function anymore in the postdraw-callback (gives GL
errors). Since there is no access to the OSG-managed FBO (for bliting
from FBO to FB) I have implemented my own and rendered to that instead.
I'll give you a brief overview for that:
MainCamera
- addChild(QUAD_STRIP) //an osg:Geode with
an osg::Texture2D
- addChild(LeftCamera)
- PreDrawCallback:
- if (!fbo) glGenFramebufferEXT
- glBindFramebufferEXT
- glFramebufferTexture2DEXT //attach the
osg::Texture2D
- PostDrawCallback:
- glBindFramebufferEXT(0) //bind window-system fb
LeftCamera is set to PRE_RENDER
This approach gives me the result which is shown in this picture:
http://www.apparatus.de/test1.png
Does someone have an idea what is going wrong or what I've missed? I've
looked at the RenderStage code (and much more :-) ) but I haven't found
something that might be the problem.
Or maybe there is another (better) approach to this problem. Any hints
for that?
I would appreciate any help! Thank you very much for reading :-)
Greetings
Mathias
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org