PDA

View Full Version : drawing images with opengl.


xDexx
2003.04.28, 03:35 PM
i have found this web site http://nate.scuzzy.net/docs/texture/
is this how i would draw an image(bmp,jpg,gif,ect) in opengl? is there a simpler/better way? (i am working in 2d right now)

OneSadCookie
2003.04.28, 05:05 PM
If you don't mind Mac-only, you can get QuickTime to load your images for you. See QTValuePak — http://203.79.121.211/CVS/

Iceman
2003.04.28, 05:07 PM
Try searching for glCubes in the idevgames source code section.

Hope this helps,
Iceman

kelvin
2003.04.28, 09:39 PM
I used Cocoa's NSImage and NSBitmapImageRep to get image data. It handles a lot of different formats and is a little easier to use than Quicktime.

OneSadCookie
2003.04.28, 09:52 PM
The problem with NSBitmapImageRep is that you don't have any guarantees that the format the bitmap is in is suitable for sending to OpenGL (and I've encountered cases where it's not), so you have to copy the bits out by hand into your own array before submitting the image if you want to be safe.

At least with QuickTime, you provide the pixel format and buffer that the image gets drawn into, so you can guarantee that that buffer is suitable for submission to OpenGL, no copying required.

IMO, that more than makes up for a few extra function calls :)

xDexx
2003.04.29, 01:16 PM
thanks i will check out quicktime and glcube, i am programming in carbon, i should have mentioned that earlyer. thanks you all your help!
-brett

Iceman
2003.04.30, 05:03 PM
Well if you're working on carbon then Quicktime would be the only one you could use. GLCubes is in cocoa. :blush: Sorry I should've asked that first.

Iceman