GuiTeK
GuiTeK

Reputation: 1741

Why does glDeleteTextures() have three parameters in OpenGL ES 2.0?

I'm wondering why the function GLES20.glDeleteTextures() has three parameters in OpenGL ES 2.0 whereas the "standard" glDeleteTextures() only has two parameters.

Even in the documentation, there are only two parameters.

However, in my program and many forums, the function takes a third parameter (always a 0 from what I've seen).

So, what is this third parameter?

EDIT: other functions have this "problem". glGetIntegerv() also takes a seemingly-useless third parameter (still an int) in OpenGL ES 2.0.

Upvotes: 3

Views: 688

Answers (2)

Attila Tanyi
Attila Tanyi

Reputation: 5054

It's the offset (based on the Android documentation). For example,

int[] textures = {id0, id1, id2, id3, id4, id5};
GLES20.glDeleteTextures(2, textures, 3);

Here, the number of textures to delete is 2, from offset 3. So only textures with id3 and id4 will be deleted.

It may be a common usecase to use the function like this:

GLES20.glDeleteTextures(textures.length, textures, 0);

Which should delete all the textures in the textures array.

Upvotes: 2

Reto Koradi
Reto Koradi

Reputation: 54652

This has noting to do with ES 2.0 compared to other OpenGL versions.

The reference documentation shows the C/C++ OpenGL bindings.

What you're using when you call GLES20.glDeleteTextures() are the Java bindings defined for Android. They obviously need to look different because they are for a different programming language. The Java bindings are also not standardized, so they are defined in a way that makes sense to the people responsible for Android.

Upvotes: 2

Related Questions