khdani's picture

Texture Question

Hello,
If I load many textures and generate their OpenGL ID into array, and after that
I'll bind the texture according to ID in the array it should use the appropriate texture, right?

I mean, something like this:

LoadTextures() {
 ....
 ....
 GL.GenTextures(1, out texturesArray[i]);
 ...
 ...
 ...
}
 
Paint() {
 ...
 ...
 ...
 GL.BindTexture(Texture2D,texturesArray[i]);
 ...
 ...
}

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Yes, the array will contain the texture ids generated by GenTextures. You can verify that by placing a breakpoint and checking the contents of the array in the debugger.

Another thing that may be of use is that you can create all ids at once, like:

// Assuming you need 10 textures.
int[] texturesArray = new int[10];
GL.GenTextures(texturesArray.Length, texturesArray);
khdani's picture

Thanks Fiddler!