Jump to content

  • Log In with Google      Sign In   
  • Create Account

Loading images in Opengl


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 musicon   Members   -  Reputation: 110

Like
0Likes
Like

Posted 24 May 2012 - 03:18 PM

Sorry if this has come up a gazillion times but I really need some help loading images/photos in Opengl/GLUT. I can do vector graphics but loading pre taken images (bmp/png/jpeg etc.) seem a real pitfall and more complicated than I had hoped.

To show what I have tried already I found out about Devil but I downloaded it and found nothing other than an uninstall file. Also much advice I found is from quite a few years ago and is probably outdated (eg NeHe tuts using the Glaux library - now deprecated). So basically what is the current best online tutorial or books for this?

My first project I have set myself is a Pong game in Opengl (already done in XNA), then onto shooter type games.

Also I use MSVC++ Express 2010 if that helps.

Edited by musicon, 24 May 2012 - 03:19 PM.


Sponsor:

#2 wildboar   Members   -  Reputation: 281

Like
0Likes
Like

Posted 24 May 2012 - 06:52 PM

I always used DevIL for all my projects and it works great.

#3 frob   Moderators   -  Reputation: 22697

Like
1Likes
Like

Posted 24 May 2012 - 10:17 PM

The rendering APIs themselves, both OpenGL and Direct3D, do not support loading images directly. You are still responsible for loading your textures.

There are libraries such as DevIL and SDL that do all the work of decoding images for you.

If possible you should try to get your textures in a natively-supported format, such as DXT1 or DXT5. Since those are hardware supported on all machines that matter to you, you can simply feed the data directly to the card instead of spending your time learning how to decode the hundreds of jpeg variants.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#4 Goran Milovanovic   Members   -  Reputation: 1104

Like
0Likes
Like

Posted 25 May 2012 - 12:15 AM

I used SDL with SDL_image to load in a wide variety of different image formats, and it worked really well for me.

There's a basic tutorial here for loading in a .bmp, but it's essentially the same procedure with SDL_image - you get back an SDL_Surface and you send it to the GPU via glTexImage2D.

+---------------------------------------------------------------------+

| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+

#5 musicon   Members   -  Reputation: 110

Like
0Likes
Like

Posted 25 May 2012 - 08:45 AM

Does anyone know a reliable place to download Devil? Unless I'm missing something I'm not getting any meaningful files installed.

#6 musicon   Members   -  Reputation: 110

Like
0Likes
Like

Posted 25 May 2012 - 10:26 AM

Never mind. I've got SDL up and running so may not need Devil.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS