Thread View: comp.graphics.api.opengl
3 messages
3 total messages
Started by Benjamin M. Burack
Tue, 23 Mar 1999 00:00
Losing colors on X Mesa
Author: Benjamin M. Burack
Date: Tue, 23 Mar 1999 00:00
Date: Tue, 23 Mar 1999 00:00
85 lines
3495 bytes
3495 bytes
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;
}
Re: Losing colors on X Mesa
Author: L.J. Wischik
Date: Wed, 24 Mar 1999 00:00
Date: Wed, 24 Mar 1999 00:00
15 lines
1448 bytes
1448 bytes
Benjamin M. Burack <admin@no-god.org> wrote: >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 Remember that voodoo2 uses 16 bits for its colour information, and that it encodes its colour information in a lossy sort of way so that the effective number is about 22 bits. Perhaps your similar shades of grey are too similar for this lossy algorithm. The precise details of it have not been disclosed. -- Lucian Wischik, Queens' College, Cambridge CB3 9ET. www.wischik.com/lu
Re: Losing colors on X Mesa
Author: 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;
>}
>
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads