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 5 of 5

Thread: Saving the OpenGL Graphics as a JPEG

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2003
    Location
    Coimbatore,Tamil Nadu,India
    Posts
    7

    Saving the OpenGL Graphics as a JPEG

    Hello,
    I have a Layout drawn using the OpenGL Commands,the Layout may be a Rectangle or anything...I want to know how can i save it as a JPEG.
    not only JPEG is there any option for BMP files..
    waiting for ur reply,
    Kalpesh.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Saving the OpenGL Graphics as a JPEG

    Hi !

    If you poke around in the archive a bit you will find tons of solutions to this, OpenGL itself does not have support for saving images, you can use glReadPixels to get image to a memory buffer, then use a library that support your image format (libjpeg...) or make some code yourself (www.wotsit.org)

    Mikael

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2003
    Location
    Coimbatore,Tamil Nadu,India
    Posts
    7

    Re: Saving the OpenGL Graphics as a JPEG

    Hi Mikael,
    Thanks a lot for ur reply,
    I think that might work out...by reading each and every pixel and storing it..
    anywayz i have an another alternative way....since am working on LINUX..
    in the Designer..there is an command available to grab the Window and store it as an image...
    the only thing there will be playing wid the coordinates...
    anywayz thanks a lot..
    - Kalpesh.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Saving the OpenGL Graphics as a JPEG

    Hi !

    You don't have to read each pixel by calling glReadPixels for each pixel, glReadPixels can copy the entire window contents in one call.

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2003
    Location
    Coimbatore,Tamil Nadu,India
    Posts
    7

    Re: Saving the OpenGL Graphics as a JPEG

    Oh..yeah...
    Thats nice...saves lot of time...
    Thanks Mikael...
    - Kalpesh.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •