Straight to the point, I am using SOIL (http://www.lonesock.net/soil.html) library to upload images into OpenGl. Loading textures works fine but there is this thing i dont fully comprehend.
Lets say I load an image into OpenGL via SOIL and I want to reuse the same image over few other textures so I would not load any more images to save memory. So without SOIL I would do something like this:
glGenTextures(3, &texture[0]);
thus generating 3 textures from 1 image i uploaded into texture[0]. But with SOIL to upload an image I need to use this:
texture[0] = SOIL_load_OGL_texture(
"0.bmp",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_INVERT_Y
);
So I have texture[1] and texture[2] and I want to copy over the same texture withouth reloading anything again but dont have a full idea how to do that, in SOIL header file it states something like:
/**
Passed in as reuse_texture_ID, will cause SOIL to
register a new texture ID using glGenTextures().
If the value passed into reuse_texture_ID > 0 then
SOIL will just re-use that texture ID (great for
reloading image assets in-game!)
**/
enum
{
SOIL_CREATE_NEW_ID = 0
};
but like I've said, I cant fully understand how the code would look like I described.
P.S im following this tut http://nehe.gamedev.net/tutorial/texture_filters,lighting&_keyboard_control/15002/
Note that in this tutorial he still uses the old image loading method, im using the one he formed in his previous tutorial.