How to easily load images into OpenGL
Posted: Tue Nov 17, 2009 11:39 pm
Okay so the other day I was looking up how to load pngs into openGL for textures and I found this: http://www.gamedev.net/community/forums ... hpage=1�
Basically in short it is an image library for OpenGL. I thought it would come in handy for some one who hasn't seen this.
EDIT:
This is an example for loading a png.
There are more examples on the info page of the library.
Basically in short it is an image library for OpenGL. I thought it would come in handy for some one who hasn't seen this.
EDIT:
This is an example for loading a png.
Code: Select all
/* load an image file directly as a new OpenGL texture */
GLuint tex_2d = SOIL_load_OGL_texture
(
"img.png",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
);