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

Pages: 1-

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: Dick 2011-08-04 21:10

Anyone? Why is this such a hard task? Load up an image and draw it on the screen, c'mon.

Name: Anonymous 2011-08-04 21:29

Bueller? Bueller? Bueller?

Name: Anonymous 2011-08-04 21:35

read a book; fucking retarded;

Name: Anonymous 2011-08-04 21:39

You could find some sample code somewhere that loads a texture and then renders it on a quad (a rectangle if you aren't familiar with this stuff yet), and then have the quad sit in front of the camera and use the orthographic projection (just make it 2D like and such). It might be easier in SDL. As for loading the image from various formats, you should check out some libraries that can load that stuff. If you use OpenGL, it'll probably seem more complicated than it might need to be, but you could easily do a whole bunch of 3D stuff once it was working. What are you trying to do?

Name: Anonymous 2011-08-04 21:40

I think your typical second year computer programming major at San Francisco State University could do this in like 15 minutes.

Name: Anonymous 2011-08-04 22:50

nah, opengl is so shit it needs external libraries or over 9000 lines of code to load image files

switch to direct3d

Name: Anonymous 2011-08-04 23:15

>>7
not portable

Name: Anonymous 2011-08-04 23:21

you dont need OpenGL just to load an image, you can use SDL, SFML, Allegro, even wxWidgets and QT could handle images

Name: Anonymous 2011-08-05 0:37

Is there a fast image loading library for Lisp, that works directly with CFFI-pointers?

Name: Anonymous 2011-08-05 0:38

>>10
And preferably has no C/C++ dependencies, libpng.

Name: Anonymous 2011-08-05 0:39

>>11
>no C/C++ dependencies, like libpng or libjpeg.
self fix

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.

Name: Anonymous 2011-08-05 3:17

>>13
fuck you faggot, that's no way to treat a newcomer you flaming butthole

Name: Anonymous 2011-08-05 3:45

>>6 represent

Name: Anonymous 2011-08-05 3:51

>>13
fuck

Name: Anonymous 2011-08-05 12:04

If you don't want to use library to load image, then just use bmp image format. Sure the pictures take lot's of space, but even a newb can read the image data. Just google for bmp file structure.

Name: Anonymous 2011-08-05 12:22

>>17
BMP/DIB is bloated. TGA is much more simple.

Name: Anonymous 2011-08-05 14:34

>>14,15,17
Remember to sage your posts for the benefit of all /prog/ users.

Name: Anonymous 2011-08-05 14:36

>>18
ppm is even simpler

Name: Anonymous 2011-08-05 14:43

>>20
Try XPM.

Name: Anonymous 2011-08-05 14:49

>>1
I only know SDL and Allegro.
If you're making games, learn OpenGL, you fucking slacker.

Name: Anonymous 2011-08-05 16:28

>>19
I know you mean good, but I actually wanted to bump this thread. This is less shittier than the average /prog/ thread.

Anyways, now I of course sage, since this is horribly off topic.

Name: Anonymous 2011-08-05 18:54

>>23
All good.

Name: Anonymous 2011-08-06 13:35


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