C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
capturing output in OpenGL Posted by kmyadam on 5 Aug 2005 at 9:21 AM
Hi Guys,

I am capturing an image from the output of an OpenGL program(C programming) in TGA format , and i am also attaching the code and the image captured. Any one of you know , how to capture the same picture in some other format like JPEG or GIF. I heard there are libraries to achieve this , if so How???




void Screendump(short W, short H)
 {

  FILE   *out = fopen("tga_file.tga", "w");
  char   pixel_data[3*W*H];
  short  TGAhead[] = {0, 2, 0, 0, 0, 0, W, H, 24};
  glReadBuffer(GL_FRONT);
  glReadPixels(20,40, W, H, GL_BGR, GL_UNSIGNED_BYTE, pixel_data);
  fwrite(&TGAhead, sizeof(TGAhead), 1, out);
  fwrite(pixel_data, 3*W*H, 1, out);
  fclose(out);

   }

Report
Re: capturing output in OpenGL Posted by kmyadam on 7 Aug 2005 at 3:12 PM
Hey Someone reply me .......



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.