Well, the code was fine. I just forgot to add my texture coordinates to my state set. That makes all the difference. :-)

Oh, trying to write a bitmap file with floating point data... not a good idea.

Brian

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, December 01, 2006 1:42 PM
Subject: [osg-users] Creating an Image using GL_LUMINANCE and GL_FLOAT


Hi,

I'm trying to generate an image using GL_LUMINANCE and GL_FLOAT, however no
matter what values (ranging from 0 to 1.0) I use in my image buffer, I
always get an image that has RGB values of <205,205,205>.  The number 205
is typically used when the debugger initializes variables, so this leads me
to believe that my Image object is incorrectly set up.

If I write the image to a file or simply attach it to a Texture2D object, I
only see a pure gray image.



   osg::Image* NoiseImage = new osg::Image();


   // generate random values between 0 and 1
   for (int i=0; i<NoiseBufferSize; i++)
   {
       g_NoiseImageF[i] = (float)(rand() % 4096) / 4096.0f;
   }


   NoiseImage->setImage(width,
                       height,
                       1,
                       GL_LUMINANCE,
                       GL_LUMINANCE,
                       GL_FLOAT,
                       (unsigned char*) g_NoiseImageF,
                       osg::Image::NO_DELETE);

   osgDB::writeImageFile(*NoiseImage, "c:/noise.bmp");


I've looked at various examples in the OSG examples.  One example set the
Image's internal texture format to GL_LUMINANCE_FLOAT32_ATI. I tried this,
but it simply hung my application.  I tried using GL_LUMINANCE for the
image's texture format, but that had no effect either. Any help would be
most appreciated.

Thanks,
Brian

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to