PDA

View Full Version : Helps about readpixeldata..(Color)



Voltaire
05-17-2012, 03:51 AM
Hi. I'm studying about Imaging Process using OpenGL.
I want to make a chromakey.. Therefore I want to read each color pixel data through 0~255 style.

Ex) (255,0,0) = Red, (255,255,255) = White, (28,143,39) = Bright Green

I read specification and studied about ColorTable but this reading style makes pixel data through 0~1.

Ex)

Invert Image Codes:

for(i = 0; i < 255; i++)
{
invertTable[i][0] = (GLubyte)(255 - i);
invertTable[i][1] = (GLubyte)(255 - i);
invertTable[i][2] = (GLubyte)(255 - i);
}

glColorTable(GL_COLOR_TABLE, GL_RGB, 256, GL_RGB, GL_UNSIGNED_BYTE, invertTable);
glEnable(GL_COLOR_TABLE);
break;


But I want to read pixeldata like (255,0,0).
Please help me...