Original Post
Hi!
I'm developing a game that manage a lot of textures per frame. To avoid the high use of glBindTexture I realized that these textures can be unified in a single big texture, because a lot of them uses the same size and now the theoretical problem comes:
1) Using 2D texture: If I have 8 256x256 textures, I can put them in a single 256x2048 texture. It can be a problem because some video cards doesn't support big textures (mine supports 8192x8192). If the object has only one texture, its texture will be 256x256, pretty simple.
2) Using 3D texture: If I have 8 256x256 textures, I can put them in a single 256x256x8 texture. I think that here there aren't size problems with this way. If the object has only one texture, the 3D texture can't be 256x256x1, because the official site of OpenGL tells me that a texture can't have odd numbers, so I need to put it in a 2D texture, calls glEnable(GL_TEXTURE_2D) apply it on my 3D model and when I need to use again the 3D texture I'll need to call glEnable(Gl_TEXTURE_3D) again (this is what I read somewhere that tells to call glEnable every time that you need to switch between a 1D, 2D and 3D texture.
3) Continue to using my current method: a lot of 256x256 textures, a lot of glBindTexture, glUniform to upload the texture ID to the fragment shader and sacrifice performance to not have the problems in point 1 and 2.
What I suppose to do in this situation? There are other simple ways to improve the engine? What is it the best choice?
I'm waiting replies.
I'm developing a game that manage a lot of textures per frame. To avoid the high use of glBindTexture I realized that these textures can be unified in a single big texture, because a lot of them uses the same size and now the theoretical problem comes:
1) Using 2D texture: If I have 8 256x256 textures, I can put them in a single 256x2048 texture. It can be a problem because some video cards doesn't support big textures (mine supports 8192x8192). If the object has only one texture, its texture will be 256x256, pretty simple.
2) Using 3D texture: If I have 8 256x256 textures, I can put them in a single 256x256x8 texture. I think that here there aren't size problems with this way. If the object has only one texture, the 3D texture can't be 256x256x1, because the official site of OpenGL tells me that a texture can't have odd numbers, so I need to put it in a 2D texture, calls glEnable(GL_TEXTURE_2D) apply it on my 3D model and when I need to use again the 3D texture I'll need to call glEnable(Gl_TEXTURE_3D) again (this is what I read somewhere that tells to call glEnable every time that you need to switch between a 1D, 2D and 3D texture.
3) Continue to using my current method: a lot of 256x256 textures, a lot of glBindTexture, glUniform to upload the texture ID to the fragment shader and sacrifice performance to not have the problems in point 1 and 2.
What I suppose to do in this situation? There are other simple ways to improve the engine? What is it the best choice?
I'm waiting replies.