Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: about GL_BITMAP

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    12

    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

  2. #2
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,007

    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)

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    12

    Re: about GL_BITMAP

    Thanks I think so,but I want get bitmap by GL_BITMAP,so how can I do?

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    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.

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2003
    Posts
    12

    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.

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: about GL_BITMAP

    So let's say it a third time; you can't.

  7. #7
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,007

    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)

  8. #8
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,007

    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
  •