How do I detect if desktop is 256 color?

BlitzMax Forums/BlitzMax Programming/How do I detect if desktop is 256 color?

I am leaning toward your suggestion, Dreamora.

Are you saying that SetGraphicsDriver GLGraphicsDriver() is the thing I need to check for a failure from, or GLGraphics(), or CanvasGraphics()? I think there is going to be more than one reason why these might fail, other than that the desktop is 256-color, for example maybe that there is no OpenGL driver installed.

I guess you have the option of either reporting the actual error message, which I think is not a great idea because they are not very explanitory, or just consider it a general failure and fall back to trying something else.

H&K: I came to the same conclusion last night too, to plot some known color pixel to the backbuffer and read it back. If the value comes back different or with less resolution etc, maybe that can be used to see what the buffer's depth is. But I've also found that you cannot be sure of what buffer you are reading, whether it is back or front, nor can you reliably select the buffer with glReadBuffer(). On some platforms there are issues with the way the OpenGL driver handles the buffers, some platforms don't even allow you to access the front buffer, and you cannot know that the backbuffer really is the backbuffer after doing a flip.