putting and retrieving colours...help!
Scum
cycy at isl1.ri.cmu.edu
Tue Aug 28 13:27:01 AEST 1990
I'm having a very vexxing problem right now. I'm in doublebuffer, RGB mode.
In the backbuffer, I draw an object in 3-space with 0x01f as it's colour.
Just before this, I turn off lighting mode by binding the material to 0,
set the shademodel to FLAT, and even turn off zbuffering. What I get immediately
back, however, is 0x11 ! To get the colour of the pixel, I cmov to a position
where I drew the object, and use readRGB.
Can somebody help me? I'm getting quite frustrated....
-- Chris.
(cycy at ri.cmu.edu)
printf statements have been removed. ptr->on_colour is an unsigned long.
...
...
...
...
if (flag & PCOLOURS) {
unsigned short red, green, blue;
czclear(0x00000000, 0xffffff);
zbuffer(FALSE);
shademodel(FLAT);
lmbind(MATERIAL, 0);
for (ptr= obj_inst; ptr != NULL; ptr = ptr->next) {
short r,b,g;
unsigned char cr, cg, cb;
green = (short) ((ptr->on_colour>>8) & 0x0ff);
blue = (short) ((ptr->on_colour>>16) & 0x0ff);
red = (short) (ptr->on_colour & 0x0ff);
fprintf(stderr, "red = %d, green = %d, blue = %d\n", red, green, blue);
RGBrange(red, green, blue, red, green, blue, -1023, 0);
cpack(ptr->on_colour);
(ptr->d_funct) (ptr);
cmov(ptr->params[0].arg,ptr->params[1].arg,ptr->params[2].arg);
readRGB(1,&cr,&cg,&cb);
}
RGBrange(0, 0, 0, 255, 255, 255, -1023, 0);
zbuffer(TRUE);
shademodel(GOURAUD);
}
}
--
-- Chris. (cycy at isl1.ri.cmu.edu)
"People make me pro-nuclear." -- Margarette Smith
More information about the Comp.sys.sgi
mailing list