texture modification

New Message Reply Date view Thread view Subject view Author view

From: Boris Mansencal (boris.mansencal++at++inria.fr)
Date: 02/27/2002 07:55:32


Hi,

 I have a texture that I want to modify.
I load an rgb file (not compressed). I do a pfTexture->getImage()
and I want to access the RGBA values of each pixel.

I do the following :

tex = new pfTexture;
tex->loadFile("test.rgb");

tex->setFormat(PFTEX_EXTERNAL_FORMAT, GL_RGBA8);
// tex->setFormat(PFTEX_EXTERNAL_FORMAT, PFTEX_UNSIGNED_SHORT_5_5_5_1);

tex->getImage(&bitmap, &comp, &ns, &nt, &nr);

for(i=0;i<ns*nt*nr; i++)
{
        printf("Col = %d,%d,%d\n", (bitmap[i] & 0xF000) >> 12,
                                           (bitmap[i] & 0xF00) >> 8,
                                           (bitmap[i] & 0x0F0) >> 4);
// printf("Col = %d,%d,%d\n", (bitmap[i] & 0xF800) >> 11,
// (bitmap[i] & 0x07C0) >> 6,
// (bitmap[i] & 0x003E) >> 1);
}

But I never get the intending values even with a very simple RGB file (2
pixels square file).
What's wrong with the previous code ?

As I want to modify the texture, I have also tried pfTexture->subload,
but it seems
that the pfTexture data is not modified (it is not changed when
retrieving it with getImage).
Is that right ?

Boris.

--
Boris Mansencal
INRIA Rocquencourt (France) - projet i3D
http://www-rocq.inria.fr/i3d/
mailto:boris.mansencal++at++inria.fr - Tel: +33 1 39 63 59 03


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Feb 27 2002 - 08:24:17 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.