GL_BITMAP w/ glReadPixels?

Howdy. I want to get a 0&1 representation of the screen (screen is rendered w/o texturing and lighting) can i do this using GL_BITMAP?
I do the following, but some elements in my array show up as neither 0 or 1…

bool array[sizesize]
if(array[i]) print(“1”);
else if(!array[i]) print(“0”);
else print(“x”);

i’m getting a ton of x’s on the screen. shouldn’t GL_BITMAP only give 0’s and 1s? what’s wrong??


The question you should ask yourself is: What type is C++'s “bool” in machine words?
Use GLubyte array[(size*size+7)/8] instead of “bool” and interpret the resulting values bitwise from high to low bit.
Make sure you pack parameters are set to 1 if size is not a multiple of 4.