Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

OpenGL program that draws a picture

Name: Dick 2011-08-04 21:07

Is there an OpenGL based program that allows me to load up an image (.bmp, .png or .jpg) and draw it on that window? I have been searching hours and hours and the best I can find are programs that rotate the pictures in a circle, ofc I could modify the source code but these are old examples and would never compile, half of the functions used in them haven't existed in OpenGL for years.

Help? Where can I find this? Programming my own isn't option since I only know SDL and Allegro.

Name: Anonymous 2011-08-05 1:37

There is no standard way to load an image from a file in OpenGL, you need to use something like libpng, libjpeg etc for that- then convert it to a representation usable by OpenGL (i.e.: RGBA).

To draw it on the window you need to set the projection matrix using glOrtho, and then draw a single quad which will be texture mapped to the previously created texture.

If you can't manage this I'm sorry but you are retarded; and should probably try Java instead.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List