Hello Vincenzo,

Vincenzo Marafioti wrote:
> Hi all,
> I am trying to render on a FBOViewport using a shader. The texture 
> attached to that FBO is a GL_TEXTURE_RECTANGLE_ARB and the image format 
> is RGBA 32 F . What i need is to write a generic floating point value 
> (not clamped from 0 to 1) in the RGBA channels. A snap of the code is
> 
>              beginEditCP(_img);
>                 _img->set(OSG::Image::OSG_RGBA_PF, _sizeX, _sizeY, 1, 1, 
> 1, 0, NULL, OSG::Image::OSG_FLOAT32_IMAGEDATA);                        
>             
>             endEditCP(_img);
>             beginEditCP(_texPtr);
>                 _texPtr->setImage(_img);               
>                 _texPtr->setInternalFormat(GL_RGBA32F_ARB);               
>                 _texPtr->setTarget(GL_TEXTURE_RECTANGLE_ARB);
>                 _texPtr->setMinFilter(GL_NEAREST);
>                 _texPtr->setMagFilter(GL_NEAREST);                    
>        
>                 _texPtr->setWrapS( GL_CLAMP_TO_EDGE );
>                 _texPtr->setWrapT( GL_CLAMP_TO_EDGE );               

add _texPtr->setScale(false), you don't want the texture to be scaled to 
the next power of two.

[SNIP]

rest of the code looked ok to me.

> I am trying to find a method to understand if the shader has been 
> corrected executed so, I would like to know if in your opinion:
> 1) is the previous code correct or i miss something regarding 
> GL_TEXTURE_RECTANGLE_ARB setup?

should be ok, with the scale disabled it looks fairly similar to some 
code I'm using with OpenSG 2 to set up a rectangular texture.

> 2) is there any method to easily  view the content of the image attached 
> to the fbo? I can't use "write" method because of its depth ("Invalid 
> pixeldepth, cannot store data").

You need to choose an image format that can handle floating point 
channels. I think from the supported formats only .hdr and .exr can 
handle that, both seem to support writing in OpenSG (.exr only 16 bit 
float).

        Cheers,
                Carsten

------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to