Best Texture Method

Sage
Posts: 1,066
Joined: 2004.07
Post: #1
Can somebody point me to, or give me, code for what they consider the best way of using textures with SDL/OpenGL?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #2
Check out the NeHe tutorials - there is a TGA loader (which is what most people use) tutorial there. http://nehe.gamedev.net
Quote this message in a reply
Moderator
Posts: 698
Joined: 2002.04
Post: #3
When porting for neheX, I also wrote an SDL_image based texture loader, dl here.
(Note that due to a minor undocumented feature in SDL, you'll have to run it in millions of colours, or artifacts will start being introduced into the textures; the fix is literally one line, but I just haven't had the time to upload yet Bored )

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Member
Posts: 156
Joined: 2002.11
Post: #4
This one just uses OpenGL, no SDL:

http://webpages.charter.net/utopiaplanet...Struct.dmg
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #5
Does anybody know of a PNG loader for OpenGL (run through SDL)?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #6
like sealfin said, you want sdl_image. It will load several common image types into an SDL surface with a single function call.
SDL_image page
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #7
Ok thanks.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #8
How do I install it? I ran ./configure in the terminal but was told that I needed SDL Version 1.2.4 and I have 1.2.7. Is there another way to take care of installing SDL_image?
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2004.08
Post: #9
SimReality/Nick Wrote:How do I install it? I ran ./configure in the terminal but was told that I needed SDL Version 1.2.4 and I have 1.2.7. Is there another way to take care of installing SDL_image?

Download the development .pkg of it for OS X from the SDL_Image site, then install it. Then add to your project the SDL_Image framework from ~/Library/Frameworks/. Next you need to compile it into your project like the other forum posts show (same as compiling SDL in). Then in your files do '#include <SDL_image/SDL_image.h>'
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #10
compile it into my project? i'm not sure i've done that with anything yet.
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2004.08
Post: #11
SimReality/Nick Wrote:compile it into my project? i'm not sure i've done that with anything yet.

Add a new "Copy Build Phase" to your project, click on the main project file to show all the files, then drag the SDL_image framework into "Target->YourTarget->Copy Files"
Quote this message in a reply
Post Reply