Overlay window colors

New Message Reply Date view Thread view Subject view Author view

Tommy Fortes (tommy++at++claws14.prosolvia.se)
Wed, 8 May 1996 14:56:22 -0600


Hi Performers!

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 Technology

E-Mail: tommy++at++clarus.se URL: http://www.clarus.se


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:52 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.