[osg-submissions] Move MRT into FBO patch

J.P. Delport jpdelport at csir.co.za
Wed Apr 16 03:21:05 PDT 2008


Hi,

Robert Osfield wrote:
> HI Art,
> 
> On Tue, Apr 15, 2008 at 9:29 PM, Art Tevs <stud_info2 at yahoo.de> wrote:
>>  1) I do not know if the draw buffer implementation
>>  could also be a non color buffer, i.e. depth or
>>  stencil buffer. If yes, then there should be some
>>  changes made in the setAttachment method, which do
>>  also add non color buffers targets to the _drawBuffers
>>  array. However this could be added in later version,
>>  if somebody need this.
> 
> My tweak to setAttachment simply followed the code that you
> had added to apply().  As to whether we should add the other
> buffer types, this depends upon the spec.  I'll need to go review
> the glDrawBuffers spec.

AFAIK, glDrawBuffers takes only GL_COLOR_ATTACHMENT?_EXT values. You can 
still read back the depth if it is attached. So I think the current code 
is fine.

> 
> 
>>  2) I still wonder if one should add something like:
>>  glDrawBuffer(default_buffer) in the
>>  FrameBufferObject::apply method just right after the
>>  line 610:
>>  ext->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
>>
>>  which will restore the default draw buffer if user
>>  ment to have this. Otherwise I still do not understand
>>  how the previous draw buffer get restored after
>>  applying an fbo.
> 
> One either needs to a glDrawBuffers() with the default in this
> instance or when you apply a FBO without its own glDrawBuffers
> call it should call glDrawBuffers with the default.  Personally I
> feel that doing the later is more efficient as it'll involve less
> thrashing of the glDrawBuffers.
> 
>>  All current implementations/examples do only work
>>  because there is a call to glDrawBuffer in the
>>  RenderStage class, which do set the default buffer
>>  just right before rendering. However if I am for
>>  example not using any RenderStage to render, then
>>  there will be no setting to default buffer.
> 
> Could we remove this glDrawbuffers call from RenderStage
> and find out?

Robert, I'm not sure if you meant "glDrawBuffers" here?

Currently there is no glDrawbuffers call in RenderStage, it is called in 
FBO:apply. However, if we are not using MRT, one should call 
glDrawBuffer at some stage. Currently this choice is made in RenderStage:

if (using mrt)
	fbo->apply (which results in glDrawBuffers)
else
	glDrawBuffer with buffer as set in member var of RenderStage

So I don't think we can easily get rid of glDrawBuffer as it is 
currently used. glDrawBuffers is only used with fbo's, but glDrawBuffer 
is used in a lot of other combinations in OSG. So setting a default for 
glDrawBuffer in fbo is I think not a good solution.

However, maybe in future refactoring one might move the glDrawBuffer 
call to some other state->apply?

regards
jp

> 
> Robert.
> _______________________________________________
> osg-submissions mailing list
> osg-submissions at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> 

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.



More information about the osg-submissions mailing list