Advertisement
Guest User

Untitled

a guest
Jul 11th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. static void
  2. write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
  3. {
  4. int i, x, y;
  5. const GLubyte *ptr = buffer;
  6. fprintf(stdout,"P6\n");
  7. fprintf(stdout,"%i %i\n", width,height);
  8. fprintf(stdout,"255\n");
  9. for (y=height-1; y>=0; y--) {
  10. for (x=0; x<width; x++) {
  11. i = (y*width + x) * 4;
  12. fputc(ptr[i], stdout); /* write red */
  13. fputc(ptr[i+1], stdout); /* write green */
  14. fputc(ptr[i+2], stdout); /* write blue */
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement