Jump to content
  • Advertisement
Sign in to follow this  
Alpha Nox

OpenGL Best texture format

This topic is 4139 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, I'm really new to OpenGL and I was wondering what texture format should I use for my game? It's a 2d game in zelda like style, I intend to use either alpha channels or color keying in the textures and heard about TGA, DXT etc. So what format would be the best for me to use? I'd also appreciate if you know any websites with tutorials on how to use that texture format By the way, I'm using SDL+OpenGL. Thanks in advance, Victor Freire

Share this post


Link to post
Share on other sites
Advertisement
png files have alpha values..
you can load them with glpng library [see link for more]

this library is very easy to use - here is the simplest example:
pngInfo info;
GLuint id = pngBind("Texture.png", PNG_NOMIPMAP, PNG_SOLID, &info, GL_CLAMP, GL_NEAREST, GL_NEAREST);
if (id != 0)
{
puts("Loaded Texture.png with resounding success");
printf("Size=%i,%i Depth=%i Alpha=%i\n", info.Width, info.Height, info.Depth, info.Alpha);
}
else
{
puts("Can't load Texture.png");
exit(1);
}

and then just glBindTexture(GL_TEXTURE_2D, id);

Share this post


Link to post
Share on other sites
Ok, I just downloaded and I'm going to try it, it seems really simple to use indeed.

Thanks a lot for the quick answer!


Share this post


Link to post
Share on other sites
I'd say, download the DevIL image library, and don't worry about your formats. Later on you may want to favor certain formats due to compression or speed benefits, but at this stage it really doesn't matter.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!