Hi,

sorry, more questions...

Peter Wraae Marino wrote:
Hi jp,

If I was to post the entire render setup it would be so big.. but I'll
try and break it up into pseudo form:

-osg::Camera setSourceType GL_FLOAT

you mean you set this on the camera's attached texture?

-osg::Camera setInternalFormat GL_LUMINANCE32F_ARB
-osg::Camera detaches osg::Camera::COLOR_BUFFER

why the detach?

-osg::Camera attaches osg:::Camera::COLOR_BUFFER with osg::Image

you can have a texture and image attached. If you view the texture with the main OSG camera, are the values what you expect?

-the RTT uses the above camera to render an image
-use osgDB::writeImageFile using image as input and file "test.png"

png supports 16bit grayscale

try tiff, it supports luminance with 32-bit float.

jp


hope this helps,
Peter




On Thu, Aug 27, 2009 at 10:01 AM, J.P. Delport<jpdelp...@csir.co.za> wrote:
What format are you trying to write the file to? How are you attaching the
image to your camera? i.e. where are the luminance values coming from?

jp

Peter Wraae Marino wrote:
Hi osgUsers,

I'm still battling with the luminance texture to file.
The problem is I need to save a texture with 32bit floating point
value for each pixel in the texture
as a file and load it in at a later time. (16bit can also be used if
32bit isn't supported).

I have tried all these combinations:

m_rImage = new osg::Image;
//m_rImage->allocateImage( 1024, 1024, 1, GL_LUMINANCE, GL_BYTE );
     // fails
//m_rImage->allocateImage( 1024, 1024, 8, GL_LUMINANCE, GL_BYTE );
     // fails
//m_rImage->allocateImage( 1024, 1024, 24, GL_LUMINANCE, GL_BYTE );
      // fails
//m_rImage->allocateImage( 1024, 1024, 16, GL_LUMINANCE, GL_FLOAT );    //
fails
//m_rImage->allocateImage( 1024, 1024, 32, GL_LUMINANCE, GL_FLOAT );    //
fails
//m_rImage->allocateImage( 1024, 1024, 24, GL_LUMINANCE, GL_4_BYTES
);      // fails with crash
//m_rImage->allocateImage( 1024, 1024, 24, GL_RGB, GL_BYTE );
      //
works ( image 8bit in each RGB )
//m_rImage->allocateImage( 1024, 1024, 24, GL_RGB, GL_FLOAT );
     //
works ( image 8bit in each RGB ), but all values zero
//m_rImage->allocateImage( 1024, 1024, 24, GL_RGB, GL_4_BYTES );
     //
fails with crash
//m_rImage->allocateImage( 1024, 1024, 32, GL_RED, GL_FLOAT );
     //
works, but fails when writing image to file

the only one that gave anykind of result was the GL_RGB, GL_BYTE ...
am I missing something?

anyone?

Peter

On Wed, Aug 26, 2009 at 1:57 PM, Peter Wraae Marino<osgh...@gmail.com>
wrote:
Hi Rafa,

thanks.. i used your suggestion and it works.

my only problem now is that the RTT i have created generates a
GL_LUMINANCE image,
which format do I use?

I would like to load and use this texture again as luminance texture.

any suggestions,
Peter

On Tue, Aug 25, 2009 at 12:25 PM, Rafa Gaitan<rafa.gai...@gmail.com>
wrote:
Hi Peter

You can attach an image to the camera doing the rtt.

osg::Image *image = new osg::Image;
image->allocateImage(tex_width, tex_height, 1, GL_RGBA,
GL_UNSIGNED_BYTE);

// attach the image so its copied on each frame.
camera->attach(osg::Camera::COLOR_BUFFER, image);

Rafa.



On Tue, Aug 25, 2009 at 12:22 PM, Peter Wraae Marino<osgh...@gmail.com>
wrote:
Hi Maxim ,

I believe the readPixels is reading from the framebuffer and not the
texture (or am I mistaken??)
remember a RTT usually means I have 2 or more cameras in my scene...
where one is used
to do the RTT... so this can lead to a question how would osg::Image
know which buffer to read from?

Peter

On Tue, Aug 25, 2009 at 12:16 PM, Maxim Gammer<maxgam...@gmail.com>
wrote:
Hi...

osg::ref_ptr<osg::Image> image = new osg::Image;

image->readPixels..... example

if (osgDB::writeImageFile(*image,_filename))

{

std::cout << "Saved screen image to `"<<_filename<<"`"<< std::endl;

}

2009/8/25 Peter Wraae Marino <osgh...@gmail.com>
Hi osgUsers,

I have a question about texture to file. Currently I have render to
texture (RTT) and would like to save this texture to a file. Is there
a straight forward method of doing this?

anyone?

--
Regards,
Peter Wraae Marino

www.osghelp.com - OpenSceneGraph support site
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
Maxim Gammer


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Regards,
Peter Wraae Marino

www.osghelp.com - OpenSceneGraph support site
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial  http://www.ai2.upv.es
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
Regards,
Peter Wraae Marino

www.osghelp.com - OpenSceneGraph support site



--
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.

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-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.

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to