Determine whether system support GLUT_INDEX?

I created a program using GLUT APIs under Windows XP.
#include <GL\glut.h>
#include <stdio.h>

void init(void)

gluOrtho2D(0, 300, 0, 300);


void indexColor(void)
glRecti(50, 50, 150, 150);

void main(int argc, char** argv)
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_INDEX);
glutInitWindowPosition(100, 100);
glutInitWindowSize(300, 300);
glutCreateWindow(“Index Color”);



But it turns out an error message “pixel format with necessary capabilities not found”.It seems that my system does not support GLUT_INDEX color mode.

My question is: how to determine whether a system support the GLUT_INDEX color mode? do linux system support GLUT_INDEX color mode?


Color index mode is very heavily deprecated these days. Any specific reason why you can’t use RGBA?

The textbook from which I learn OpenGL mention it and the benefits of this mode.

Erm, ditch that book immediately.

Index mode is not used by anyone anymore for about 15 years now. If that book suggests to use it, it is either extremely old, or the author is an idiot.

“Today” everything is rendered in RGBA mode.

Using a color-table does allow you to do some nice effects (color-table animations), but today no one does that anymore. And even if you wanted to have such behavior, there are much better ways these days (through shaders).


Oh,thanks for the hint.

But the textbook I am using Computer Graphics with OpenGL,3rd was first published at 2004.

Maybe I should consider the index mode section as history rather practice.

Color index mode is something that’s required to be supported in order to pass conformance, but nobody uses it these days and you can bet that hardware acceleration in color indexed mode is going to be patchily supported at best. Unless you have something very very specific that you know for a fact that color index mode is the only solution for, and unless you don’t care about performance, you really should use RGBA and forget what that book told you.

I have decided to forget it since I have made a test in my ubuntu and it does not support the index color mode either.

You can determine whether GLUT_INDEX is supported or not based on the following piece of code, basically glutGet(GLUT_DISPLAY_MODE_POSSIBLE) indicates whether current display mode is supported or not.

glutInitDisplayMode (GLUT_SINGLE | GLUT_INDEX);