Load images

Official forum for the Chipmunk2D Physics Library.
Post Reply
onizuka-21
Posts: 2
Joined: Sat Feb 09, 2008 4:55 pm
Contact:

Load images

Post by onizuka-21 »

Hi
I am aware this is not the best place for such a question, please forgive my noobness...
I have seen some of you loading images into their Chipmunk application, and I'd like to know if there is an easy way to do so. I've been looking for GLUT or OpenGL libraries that load external images files, but none seemed to suit my simple needs, they use complex texturing stuff that would make no sense in a simple 2D program.
So what code do you generally use to simply place an image on the scene?

Cheers
maximile
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK
Contact:

Re: Load images

Post by maximile »

Lots of the Chipmunk demos you see are drawn with OpenGL, because it's fast and lots of people know it. If you want to use OpenGL to draw images, even in 2D, you'll need to use "complex texturing stuff". It's not actually that complex, but it can be a bit tricky, so I don't blame you for wanting to stay away from it.

I'm sure others here will be able to advise you on alternatives if you don't want to use OpenGL. If you're on a Mac, Quartz is fast enough for lots of things and easy to use. Or you might want to have a look at the options Python or Ruby give you, but I've never used them.
onizuka-21
Posts: 2
Joined: Sat Feb 09, 2008 4:55 pm
Contact:

Re: Load images

Post by onizuka-21 »

Thank you for the fast reply :)

Yes it is definitely OpenGL I want to use, but I'm pretty new to that... As I have seen flat images in other projects on this forum, I just would like to know what code they use to load these images in 2D!

Cheers
Kingdom Of Fish
Posts: 21
Joined: Sun Jan 27, 2008 10:56 am
Contact:

Re: Load images

Post by Kingdom Of Fish »

I would recommend you to use SFML, its really easy to use and works well with chipmunk.
lucas
Posts: 54
Joined: Wed Sep 26, 2007 2:34 am
Contact:

Re: Load images

Post by lucas »

I use DevIL to load my images, as it integrates well with OpenGL.
Don't make the same mistake I did and use SDL, you need a hardware based API like OpenGL (constant rotation is slow as anything in SDL)
Tangame - a tangram puzzle game with physics.
http://code.google.com/p/tangame/
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Load images

Post by slembcke »

I'll put in a plug for SOIL here. Very very simple and lightweight. You can load textures in a single line of code.

The only feature it's missing IMO is premultiplying the alpha.

http://www.lonesock.net/soil.html
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Blue Prawn
Posts: 22
Joined: Thu Jan 03, 2008 1:36 pm
Contact:

Re: Load images

Post by Blue Prawn »

Here is a simple tutorial on how to use openGL for 2D game rendering:
http://www.meandmark.com/tilingpart1.html
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests