In my game, I have:
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texID);
Where texID is an integer returned by my setTexture() method. Let's say, in this instance it's 1.
When I bind my textures during rendering calls, I don't want to bind this texture every single call. Because I use different atlases of various textures and it's pretty wasteful to keep re-binding a texture when it's not required.
So, I would like to do something like this (Pseudo code)
if (texID != *currentTexture*){
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texID);
}
Therefore, if the texture I want to use is the same as the one already bound, the call to re-bind it will be ignored.
I can't work out how to get the ID of the texture that is currently bound.
I've tried
GLES20.glActiveTexture();
But this doesn't return the textureID, it returns the texture Units
Help appreciated
Edit
I've tried the suggestion below but I'm getting the folowing errors:
When hovering over the underline, this is the error:
I had searched this site and the wider web for a couple of hours before posting here but couldn't find a proper usage example, just this out of context snippet.
GL_INT
is a symbolic constant used to identify types internally. What you are looking for isGLint
, this guy is an actual type! Also, you might consider just remembering the current texture yourself, instead of querying the OpenGL state. \$\endgroup\$