PDA

View Full Version : Problems with Pixel Mapping



yossi
08-15-2000, 04:31 AM
I am trying to render an image of indexes and have problems.

The code look like this:

#define checkImageWidth 64
#define checkImageHeight 64
GLubyte checkImage[checkImageHeight][checkImageWidth];

static GLushort lutr[256], lutg[256], lutb[256];

static GLushort lut1[3][256];

/*Image initialization*/
for (i = 0; i < checkImageHeight; i++)
for (j = 0; j < checkImageWidth; j++)
checkImage[i][j] = 128;

/*LUTs initialization */
for (i = 0 ; i < 256 ; i++)
{
lutr[i] = 0;
lutg[i] = 255;
lutb[i] = 0;
}

/* Pixel transfer and Pixel mapping */
glPixelTransferi(GL_MAP_COLOR, GL_TRUE);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelMapusv(GL_PIXEL_MAP_I_TO_R, 256, lutr);
glPixelMapusv(GL_PIXEL_MAP_I_TO_G, 256, lutg);
glPixelMapusv(GL_PIXEL_MAP_I_TO_B, 256, lutb);

/* Rendering */
glRasterPos2i(30, 30);
glDrawPixels(checkImageWidth, checkImageHeight, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, checkImage);

I expect to find a green square on see only a black one.
I check the parameters with "glGet*" function
and find that mapping and luts size mapping is OK. But when reading back the mapped luts I find them to be all zeros.
Whats wrong?

paul
08-31-2000, 01:45 AM
I wrote about this problem in my post.
The only way I know to workaround this problem is to use card with Permedia 2 chip.
I have my old ELSA card with Permedia 2 and Pixel Mapping works good.