Thursday, August 25, 2011

Color indexing not supported.

I'm going to start documenting the solutions to errors I encounter while programming when I feel the error is likely to be encountered by others. So, anyhow, this is the first one.

When trying to compile the GLUT redbook examples, you may get the following runtime error:
craigp@liasson> make && ./aaindex.bin
gcc -Wall -I/lusr/X11/include -I/lusr/include -o aaindex.bin -L/lusr/X11/lib -L/lusr/lib -lglut -lGLU -lGL -lpthread -lm aaindex.c
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 128 (GLX)
Minor opcode of failed request: 26 (X_GLXMakeContextCurrent)
Serial number of failed request: 49
Current serial number in output stream: 49
What was happening in my case was that the system dose not support color indexing mode. Change the following line
glutInitDisplayMode (GLUT_SINGLE | GLUT_INDEX);
to
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGBA);
I'm not exactly sure where to view the capabilities of X11 or if it is possible to enable color indexing mode at all without root access. The header states
/*
* Initialization functions, see fglut_init.c
*/
. . .
FGAPI void FGAPIENTRY glutInitDisplayMode(unsigned int displayMode);
. . .
so if you absolutely must know, that may be the place to start looking.

No comments:

Post a Comment