Re: Overlay window colors

New Message Reply Date view Thread view Subject view Author view

Sharon Clay (src++at++rose.asd.sgi.com)
Wed, 8 May 1996 11:09:56 -0700


+>---- On May 8, 9:57am, dheskamp++at++ldsa.com wrote:
> Subject: RE: Overlay window colors
->
->I had the same problem until I used the Performer utilities instead of X utilities. For setting overlay colors try the
->following code fragment which uses "pfuGLXMapcolors":

Glad you found those utilities helpful.

Tommy, I think the only thing you are missing in your code is
a call to XMapWindow(). I also did an XSync() in pfuGLXMapcolors()
to make sure that immediate one-time drawing following would
get the proper colors. Otherwise, an XFlush() would have sufficed.

->
-> myOverlay = myWindow->getOverlayWin();
-> if (myOverlay)
-> {
-> if (!overlayMapped)
-> {
-> static pfVec3 clrs[2];
-> clrs[0][0] = 0.0f; /* black */
-> clrs[0][1] = 0.0f;
-> clrs[0][2] = 0.0f;
-> clrs[1][0] = 0.5f; /* grey */
-> clrs[1][1] = 0.5f;
-> clrs[1][2] = 0.5f;
-> Display *dsp = pfGetCurWSConnection();
-> Window xowin = myOverlay->getWSDrawable();
-> pfuGLXMapcolors((pfuXDisplay*) dsp, xowin, clrs, 1, 2);
-> overlayMapped = 1;
->
->--- Begin Included Message ---
->
->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
->--- End Included Message ---
->
->Dave Heskamp
->
->Lockheed Martin Tactical Defense Systems
->1210 Massillon Road
->Akron, Ohio 44315-0001
->
->phone: (330) 796 - 5383
->fax: (330) 796 - 7009
->email: dheskamp++at++ldsa.com
->
+>---- End of excerpt from dheskamp++at++ldsa.com

-- 
-----{-----{---++at++   -----{----{---++at++   -----{----{---++at++   -----{----{---++at++
Sharon Rose Clay (Fischler) - Silicon Graphics, Advanced Systems Dev.
src++at++sgi.com  (415) 933 - 1002  FAX: (415) 965 - 2658  MS 8U-590
-----{-----{---++at++   -----{----{---++at++   -----{----{---++at++   -----{----{---++at++

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.