From: faculaganymede (faculaganymede++at++yahoo.com)
Date: 11/16/2004 20:05:20
pfExpert,
I am running a Performer program on an SGI Onyx300. I
want to get the R, G, and B value of each pixel in an
image saved in the framebuffer (that is configured to
12-bit RGB).
One method to do this (that I know of) is to use the
glReadPixels function, as follows:
unsigned short image2[HEIGHT][WIDTH][3];
...
glReadPixels(0,0, WIDTH, HEIGHT, GL_RGB,
GL_UNSIGNED_SHORT, image2);
//get RGB value for pixel located at image2(100,100)
unsigned short red2;
unsigned short green2;
unsigned short blue2;
...
red2=image2[100][100][0];
green2=image2[100][100][1];
blue2=image2[100][100][2];
...
The resulting image2 data consist of unsigned shorts
(16-bit data). My question is how can I translate the
16-bit data in image2 to 12-bit data (the actual
12-bit R, G, and B values in the framebuffer)? In
order words, is the 12-bit data the lower or higher 12
bits of the 16-bit data?
I know with glDrawPixels, it is necessary to shift a
16-bit value by 4 bits before writing to the 12-bit
RGB framebuffer. Is a similar operation necessary
with glReadPixels?
Please advise and thank you in advance.
=====
Thanks,
faculaganymede
__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com
This archive was generated by hypermail 2b29 : Tue Nov 16 2004 - 20:05:35 PST