Article View: comp.graphics.api.opengl
Article #17Re: Losing colors on X Mesa
From: dfghgsahaf
Date: Thu, 01 Apr 1999 00:00
Date: Thu, 01 Apr 1999 00:00
98 lines
3944 bytes
3944 bytes
jdkgshakjghnkjshnakjgbvhnkjafdsg
aglkasdlgjikjfdsaloig
dgfdasghahg
Benjamin M. Burack schrieb in Nachricht ...
>My program loads 24-bit textures and displays them with Mesa on XWindows
>with a Voodoo2 card. I'm using double-buffering and depth buffering in
RGBA
>mode (not color index). For some reason, I am losing a lot of my colors.
>For example, if I have a texture with 8 similar shades of gray, many will
>appear as exactly the same color. Only 2 or 3 shades will be rendered for
>all 8. Since my program involves subtle contrast variations, this is a
huge
>problem. I thought I would be running in a true color mode since X is set
>to 24 or 32 bit color depth, but apparently this isn't the case. Why does
>this happen? How can I fix it?
>
>Posted below is some of the code, such as the colormap initialization, that
>may cause the problem.
>
>Thanks for any help, and please mail responses to rascal@tseinc.com ,
>Benjamin Burack
>
>
>
>
>
>int configuration[] = {GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
>None};
>
>void main(int argc, char **argv)
>{
> XVisualInfo *vi;
> XSetWindowAttributes swa;
> XWMHints *wmHints;
> Atom wmDeleteWindow;
> GLXContext cx;
>
><snip>
>
>
> /*** find an appropriate visual and a colormap for it ***/
> /* find an OpenGL-capable RGB visual with depth buffer */
> if (!bDoubleBuffer) goto SingleBufferOverride;
> vi = glXChooseVisual(pDisplay, DefaultScreen(pDisplay), configuration);
> if (vi == NULL) {
> SingleBufferOverride:
> vi = glXChooseVisual(pDisplay, DefaultScreen(pDisplay),
>&configuration[1]);
> if (vi == NULL)
> fatal_error("no appropriate RGB visual with depth buffer");
> bDoubleBuffer = GL_FALSE;
> }
> cmap = getColormap(vi);
>
><snip>
>
> /*** create an OpenGL rendering context ***/
> cx = glXCreateContext(pDisplay, vi, /* no sharing of display lists */
>NULL,
> /* direct rendering if possible */ GL_TRUE);
> if (cx == NULL) fatal_error("could not create rendering context");
>
><snip>
>
>}
>
>Colormap getColormap(XVisualInfo* vi)
>{
> Status status;
> XStandardColormap* standardCmaps;
> Colormap cmap;
> int i, numCmaps;
>
> status = XmuLookupStandardColormap(pDisplay, vi->screen, vi->visualid,
>vi->depth, XA_RGB_DEFAULT_MAP, FALSE, TRUE);
>
> if (status == 1) {
> status = XGetRGBColormaps(pDisplay, RootWindow(pDisplay, vi->screen),
> &standardCmaps, &numCmaps, XA_RGB_DEFAULT_MAP);
> if (status == 1)
> for (i = 0; i < numCmaps; i++)
> if (standardCmaps[i].visualid == vi->visualid) {
> cmap = standardCmaps[i].colormap;
> XFree(standardCmaps);
> return cmap;
> }
> }
> cmap = XCreateColormap(pDisplay, RootWindow(pDisplay, vi->screen),
> vi->visual, AllocNone);
> return cmap;
>}
>
>
>
Technical Details
Message-ID:
<7dvtpe$deb$1@news.swissonline.ch>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<alVJ2.129$E04.420@news9.ispnews.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f65bb,fe70503bb01cdf44 X-Google-Attributes: gidf65bb,public X-Google-Thread: 104191,fe70503bb01cdf44 X-Google-Attributes: gid104191,public X-Google-Thread: f9b07,fe70503bb01cdf44 X-Google-Attributes: gidf9b07,public From: "dfghgsahaf" <thosuter@swissonline.ch> Subject: Re: Losing colors on X Mesa Date: 1999/04/01 Message-ID: <7dvtpe$deb$1@news.swissonline.ch> X-Deja-AN: 461572005 Content-Transfer-Encoding: 8bit References: <alVJ2.129$E04.420@news9.ispnews.com> Content-Type: text/plain; charset=ISO-8859-1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 X-Complaints-To: abuse@swissonline.ch X-Trace: news.swissonline.ch 922974830 13771 195.24.72.73 (1 Apr 1999 13:53:50 GMT) Organization: Swissonline (Cablecom Media), Zurich, Switzerland Mime-Version: 1.0 NNTP-Posting-Date: 1 Apr 1999 13:53:50 GMT Newsgroups: comp.graphics.api.opengl,3dfx.glide.linux,3dfx.linux.dev.glide