-
about GL_BITMAP
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
!
if I want get GL_BITMAP,so how can I do?
Thanks
-
Senior Member
OpenGL Pro
Re: about GL_BITMAP
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)
-
Re: about GL_BITMAP
Thanks I think so,but I want get bitmap by GL_BITMAP,so how can I do?
-
Senior Member
OpenGL Guru
Re: about GL_BITMAP
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.
-
Re: about GL_BITMAP
Yes,A bitmap in OpenGL is a one bit image ,How to get one bit image by GL_BITMAP?
Thanks Bob.
-
Senior Member
OpenGL Guru
Re: about GL_BITMAP
So let's say it a third time; you can't.
-
Senior Member
OpenGL Pro
Re: about GL_BITMAP
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)
-
Senior Member
OpenGL Pro
Re: about GL_BITMAP
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)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules