Search code examples
openglcolor-mapping

OpenGL color index mode not working, color map has size 0


I am learning some OpenGL through this guide and I have arrived at an example that uses color index mode. In Chapter 6, example 6-4 establishes antialising of lines in color-index mode. I wrote the code in and compiled it. The code runs but the problem is that the lines that should be colored are just white. I stuck this line in my init() function:

printf("The size of the color map is %d entries\n", glutGet(GLUT_WINDOW_COLORMAP_SIZE));

which printed "The size of the color map is 0 entries"

Did I intialize somethign wrong or does my implementation of OpenGL really not have any color-index color map entries? Is it so unused? Is that strange?


Solution

  • Color Index mode never really worked, and no current OpenGL implementation actually supports it. Best case scenario you drop to some software fallback. Worst case you get ugly rendering. Don't bother with it and skip that chapter alltogether.

    Also the guide you're reading is severely outdated.