Re: [osg-users] 16 Bit Image

2011-03-04 Thread Martin Großer
Hello Ulrich,

yes, the depth = 4 for RGBA, that's right. After the writing I want a 16 bit 
image (tiff or something linke this). I want to load this in another 
application and 8 bit per channel (red, green, blue and alpha) is too 
imprecise. So I need a 16 bit image.

I didn't get errors but the values are false in the image. It looks wrong. If I 
set all data values to 1.0f then I get a half transparent bluish image.

You see my problem? Or isn't it clear?

Thank you

Martin

 Original-Nachricht 
 Datum: Fri, 04 Mar 2011 09:06:13 +1100
 Von: Ulrich Hertlein u.hertl...@sandbox.de
 An: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Betreff: Re: [osg-users] 16 Bit Image

 Hi Martin,
 
 On 4/03/11 1:32 , Martin Großer wrote:
  I would like write a 16 bit image. I tried the follow:
  
  // image Data
  float* data = new float[width * height * depth];
 
 (float != 16-bit, but float seems to be what you're after?  'depth' == 4? 
 For RGBA?)
 
  // set data to image
  img-setImage(width, height, 1, GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT,
 (unsigned char*) data, Image::USE_NEW_DELETE);
  
  osgDB::writeImageFile(*img, test_image.tiff);
  
  How can I do this?
 
 My divining rod seems to be broken.  What is the problem again?
 Do you get an error?  Does it crash?  Does it look wrong?
 
 Cheers,
 /ulrich
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!   
Jetzt informieren: http://www.gmx.net/de/go/freephone
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] 16 Bit Image

2011-03-04 Thread Robert Osfield
Hi Martin,

The osg::Image::setInternalTextureFormat(..) only affects what the
osg::Texture will do with passing the image data to OpenGL.  In you
case you have an Image that is full 32bit floats, it won't store the
image data as 16bit floats, it's only down on the GPU that you'll find
the 16bit floats.

Given this it's not surprising that the tiff plugin won't write half
floats, and it only has full floats to write out.  I'd be surprised in
tiff even supports 16bit floats.   Tiff will support ushort images
though, so perhaps this is the route you should go.

Robert.

2011/3/4 Martin Großer grosser.mar...@gmx.de:
 Hello Ulrich,

 yes, the depth = 4 for RGBA, that's right. After the writing I want a 16 bit 
 image (tiff or something linke this). I want to load this in another 
 application and 8 bit per channel (red, green, blue and alpha) is too 
 imprecise. So I need a 16 bit image.

 I didn't get errors but the values are false in the image. It looks wrong. If 
 I set all data values to 1.0f then I get a half transparent bluish image.

 You see my problem? Or isn't it clear?

 Thank you

 Martin

  Original-Nachricht 
 Datum: Fri, 04 Mar 2011 09:06:13 +1100
 Von: Ulrich Hertlein u.hertl...@sandbox.de
 An: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Betreff: Re: [osg-users] 16 Bit Image

 Hi Martin,

 On 4/03/11 1:32 , Martin Großer wrote:
  I would like write a 16 bit image. I tried the follow:
 
  // image Data
  float* data = new float[width * height * depth];

 (float != 16-bit, but float seems to be what you're after?  'depth' == 4?
 For RGBA?)

  // set data to image
  img-setImage(width, height, 1, GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT,
 (unsigned char*) data, Image::USE_NEW_DELETE);
 
  osgDB::writeImageFile(*img, test_image.tiff);
 
  How can I do this?

 My divining rod seems to be broken.  What is the problem again?
 Do you get an error?  Does it crash?  Does it look wrong?

 Cheers,
 /ulrich
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 --
 NEU: FreePhone - kostenlos mobil telefonieren und surfen!
 Jetzt informieren: http://www.gmx.net/de/go/freephone
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


[osg-users] 16 Bit Image

2011-03-03 Thread Martin Großer
Hello,

I would like write a 16 bit image. I tried the follow:

// image Data
float* data = new float[width * height * depth];

// set image data
[...]

// create Image
ref_ptrImage img = new Image;

// image internal format
img-setInternalTextureFormat(GL_RGBA16F_ARB);

// pixel format
img-setPixelFormat(GL_RGB);

// set data type
img-setDataType(GL_FLOAT);

// set origion
img-setOrigin(Image::BOTTOM_LEFT);

// set data to image
img-setImage(width, height, 1, GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT, (unsigned 
char*) data, Image::USE_NEW_DELETE);

osgDB::writeImageFile(*img, test_image.tiff);

How can I do this?

Cheers

Martin
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!   
Jetzt informieren: http://www.gmx.net/de/go/freephone
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] 16 Bit Image

2011-03-03 Thread Ulrich Hertlein
Hi Martin,

On 4/03/11 1:32 , Martin Großer wrote:
 I would like write a 16 bit image. I tried the follow:
 
 // image Data
 float* data = new float[width * height * depth];

(float != 16-bit, but float seems to be what you're after?  'depth' == 4?  For 
RGBA?)

 // set data to image
 img-setImage(width, height, 1, GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT, (unsigned 
 char*) data, Image::USE_NEW_DELETE);
 
 osgDB::writeImageFile(*img, test_image.tiff);
 
 How can I do this?

My divining rod seems to be broken.  What is the problem again?
Do you get an error?  Does it crash?  Does it look wrong?

Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org