Article 56ZDK Creating a .png file

Creating a .png file

by
piobair
from LinuxQuestions.org on (#56ZDK)
I have a machine generated bitmapped image. Writing that image to an X-Windows screen is a lot more complicated than writing it to a *.png file. Or so I thought.

The attached program (teapots.c) generates an OpenGL image of teapots. Then, if the 'p' key is pressed, it calls subroutine "png.c" which writes that image to a file teapots.png . The <exc> key exits the program normally. (rename teapots.c.txt to teapots.c; rename png.c.txt to png.c)

The resulting file can be read by a common image reader; the reader does not hiccup over the CRC computation. However, that image is blank.

??

The program can be compiled by
gcc -o teapots teapots.c -lglut -lGL
Attached Files
txt.gifteapots.c.txt (7.7 KB)
txt.gifpng.c.txt (4.5 KB)
latest?d=yIl2AUoC8zA latest?i=20ECoBK2zvg:OXFPJ95DXYk:F7zBnMy latest?i=20ECoBK2zvg:OXFPJ95DXYk:V_sGLiP latest?d=qj6IDK7rITs latest?i=20ECoBK2zvg:OXFPJ95DXYk:gIN9vFw20ECoBK2zvg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments