Tommy Fortes (tommy++at++claws14.prosolvia.se)
Wed, 8 May 1996 14:56:22 -0600
I am trying to draw text in the overlay window from the Draw process using
OpenGL.
The text & font part is working fine, but I can't seem to be able to set
the colormap. I am changing the colormap associated with the XWindow, but it
does not seem to have any effect... I only get some default colors (which are
different from machine to machine and time to time...)
Any suggestions?
Here is a sample from my code:
// from the Draw process:
static ulong pixels[8];
pfWindow *over = pWin->getOverlayWin();
over->select();
...
Display *dsp = pfGetCurWSConnection();
Window win = over->getWSWindow();
XWindowAttributes attr;
XGetWindowAttributes(dsp, win, &attr);
Colormap cmap = attr.colormap;
if (cmap && XAllocColorCells(dsp, cmap, FALSE, NULL, 0, pixels, 2)) {
XColor color;
color.flags = DoRed | DoGreen | DoBlue;
color.pixel = pixels[0];
color.red = 0x0000; color.green = 0x8888; color.blue = 0x0000;
XStoreColor(dsp, cmap, &color);
color.pixel = pixels[1];
color.red = 0xffff; color.green = 0xffff; color.blue = 0x0000;
XStoreColor(dsp, cmap, &color);
printf("Got index %d and %d!\n", wd.pixels[0], wd.pixels[1]);
}
...
glIndexi(pixels[1]); // <--- This SHOULD give a yellow color, right?!
glRasterPos2f(x, y);
glCallLists(strlen(str), GL_UNSIGNED_BYTE, (GLubyte *) str);
Thanks for any suggestions...
/Tommy
-- --------------------------------------------------------------------- Tommy Fortes, Software Engineer at Clarus AB - Sixth Sense TechnologyE-Mail: tommy++at++clarus.se URL: http://www.clarus.se
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:52 PDT