int channels = 0; unsigned char* image = SOIL_load_image ( filename, &width, &height, &channels, SOIL_LOAD_AUTO ); if(image == NULL) { isLoaded = false; return; } GLuint tex_2d =SOIL_create_OGL_texture ( image, width, height, channels, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT ); SOIL_free_image_data ( image );
My use case is a little more complicated than the examples on the page but only because I wanted the height and width info. This handles the OpenGL Y inversion problem and dds files that have no mip maps which were the ones I was testing with.
Very nice and easy to add statically.
Also while I was debugging my problem I noticed gDebugger is now free and it works very nicely.
No comments:
Post a Comment