View Full Version : about GL_BITMAP
ymxie
08-27-2006, 12:29 AM
Dear all,
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEP TH);
///////////////////////////////////////
glReadBuffer(GL_BACK);
unsigned char t0[256*256*4];
/////////////////////////////////
//it, save it with glReadPixels,
////////////////////////////////
glReadPixels(0,0,128,128,GL_COLOR_INDEX ,GL_BITMAP,t0);
but get nothing but a GL_INVALID_OPERATION error :confused: !
if I want get GL_BITMAP,so how can I do?
Thanks
sqrt[-1]
08-27-2006, 12:59 AM
You probably want:
glReadPixels(0,0,128,128,GL_RGBA,GL_UNSIGNED_BYTE, t0);
or
glReadPixels(0,0,128,128,GL_BGRA,GL_UNSIGNED_BYTE, t0);
(depending on how you want the RGBA valud ordered)
You can't use GL_COLOR_INDEX on a RGBA surface (GLUT_RGBA)
ymxie
08-27-2006, 01:07 AM
Thanks I think so,but I want get bitmap by GL_BITMAP,so how can I do?
As he said, you cannot do that.
However, I suspect you're confusing bitmaps as in BMP image files, with bitmaps as defined by OpenGL. They are not the same thing. A bitmap in OpenGL is a one bit image (therefore the name; bit-map), where a single bit represents, sort of, "pixel on" and "pixel off".
To save a BMP image, you need to read back the image as sqrt[-1] said.
ymxie
08-27-2006, 02:53 AM
Yes,A bitmap in OpenGL is a one bit image ,How to get one bit image by GL_BITMAP?
Thanks Bob.
So let's say it a third time; you can't.
sqrt[-1]
08-27-2006, 04:50 AM
Two questions:
1) Why do you want a 1-bit image? (what are you expecting? or what are you using it for?)
2) Whay can't you just convert the RGBA data to a 1-bit image yourself. (using the glReadPixels above to get the buffer then converting using whatever filter you need)
sqrt[-1]
08-27-2006, 06:17 AM
Two questions:
1) Why do you want a 1-bit image? (what are you expecting? or what are you using it for?)
2) Whay can't you just convert the RGBA data to a 1-bit image yourself. (using the glReadPixels above to get the buffer then converting using whatever filter you need)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.