[osg-submissions] Bug in MRT and FBO

J.P. Delport jpdelport at csir.co.za
Tue Jul 15 05:07:51 PDT 2008


Hi,

Art Tevs wrote:
> Hi Robert,
> 
> 
> 
> 
>> Would just removing the possibility of using enum in
>> setAttachement
>> fix this ambiguity?  Just have osg::Camera::BufferAttach
>> used in
>> osg::FrameBufferObject?
>>
> I think it would. However having the enums it is possible to do something like this:
> 
> for (int i=0; i < 4; i++)
>    fbo->setAttachment(GL_COLOR_BUFFER0_EXT + i, ...);
> , which is correct in respect to OpenGL specificatiosn, since GL_COLOR_BUFFERn_EXT = GL_COLOR_BUFFER0_EXT + n.
> 
> 
> If you remove the GLenum then one has to write something like this:
> 
> for (int i=0; i < 4; i++)
>    fbo->setAttachment(Camera::BufferAttachment(int(Camera::COLOR_BUFFER0) + i), ...);
> 
> which ends up in a lot of casts, which is not so nice code style (one can not add integer value to an enum value).

I have code like this,
_Camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0+i), 
_OutImage.get());

The syntax does not bother me too much.

> 
> Hence I would propose to let the GLenum in there or to work out a new API interface to solve that problem.
> 
> Best regards,
> Art
> 
> P.S. Sorry, I do not remember the discussion about the using of COLOR_BUFFER!=COLOR_BUFFER0. I can not see any issue which might be introduced by setting COLOR_BUFFER=COLOR_BUFFER0. Could you explain me in few words why?

In short: There was no way for OSG do differentiate between the 
following two cases:
1) _Camera->attach(COLOR_BUFFER)
User uses gl_FragColor in shader and therefore does not want MRT enabled.

2) _Camera->attach(COLOR_BUFFER0)
User uses gl_FragData[0] in shader and wants MRT to be enabled.

COLOR_BUFFER!=COLOR_BUFFER0 makes the above choice explicit.

rgds
jp

>  
> 
> 
> 
>       __________________________________________________________
> Gesendet von Yahoo! Mail.
> Dem pfiffigeren Posteingang.
> http://de.overview.mail.yahoo.com
> _______________________________________________
> 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