Hi Wojciech,

I was browsing/searching the mailing list and found this topic. A question is interspersed below.

Am 07.08.09 18:52, schrieb Wojciech Lewandowski:
Hi Robert and J-S and all interested,

I have prepared the code for the proposal. There was a bunch of changes
to Camera/SceneView/CullVisitor/RenderStage (and few other files). Its
not exactly like what we planned because practice once again showed the
theories are only work on paper and on the internet;- ).

I initially have written the code for lazy updates of DrawBuffer and
ReadBuffer to osg::State. But during debugging & reading FBO spec again,
I learned that it does not make sense. OpenGL treats
DrawBuffer/ReadBuffers as members of FBO state. Buffers are not unique
per GL context but each FBO can have them set differently and once FBO
is bound its DrawBuffer/ReadBuffer selection is made active. So it won't
work to keep them in State.

For the first point of our plan I also had to make modifications.
Fortunately, as planned, camera uses inheritance DRAW_BUFFER /
READ_BUFFER masks. However, RenderStage code seems to not always expect
presence of associated camera that would contain valid
DrawBuffer/ReadBuffer settings. For this case it was neccessary to add
_drawBufferApplyMask / _readBufferApplyMask flags to RenderStage. These
flags effectively replace former case of
RenderStage::_drawBuffer/RenderStage::_readBuffer being set to GL_NONE.
These flags are now used to inform RenderStage to inherit / not touch
buffer settings from what was set in prior stage.

See the attached code for details. I must admit that this modification
eluded me a bit. I hope I did everything properly, but I really count on
peer reviews.

I have left FORCE_COLOR_ATTACHMENT / FORCE_DEPTH_ATTACHMENT defines in
the RenderStage.cpp. I expect that Robert will take decision to remove
them or keep them for a while. FORCE_COLOR_ATTACHMENT is set to 0 but
FORCE_DEPTH_ATTACHMENT is set to 1. I tested the changes with Viewer
Prerender/ Shadow examples. I noticed that when DEPTH_ATTACHMENT is not
forced, depth tests in Prerender fail and Cow.osg or Cessna.osg are
displayyed with "holes". So it would be necccesary to test all examples
using FBOs and check if they require exlpicit setting of depth
attachments. Once examples are fixed one may turn off
FORCE_DEPTH_ATTACHMENT in RenderStage.cpp.

This sounds exactly like the issue I'm currently experiencing. I've already tried to find some help in this topic: http://forum.openscenegraph.org/viewtopic.php?t=3322 I had to create/manage my own FBO since I need a handle to it for various reasons. Basically I'm trying to do RTT. This means my FBO has just a texture2d attached to it (as GL_COLOR_ATTACHMENT). Do you know what the reason for this behaviour is? Am I right that attaching a depth attachment to an FBO solves the issue? What is different in your implementation when FORCE_DEPTH_ATTACHMENT is set?


Uff, It was bit exhausting. I have spent 3 days on this stuff and I must
admit that it is still undertested. Unfortunatelly, I have to move over
to other activities this week. If it becomes neccessary, I will go back
to the subject after next weekend. Although I doubt I will be able to do
any coding this week but I should be able to stay in touch with forums.
I also hope, that in the meantime You will look at these changes, test
them and make neccessary tweaks or send me requests for aditional changes.

Cheers,
Wojtek





Thanks for any help.
Mathias Buhr
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to