glDeleteTextures

Problems with Canvas, OpenGL, etc...

glDeleteTextures

Postby DannyG » Fri Dec 10, 2010 2:59 pm

I'm a bit confused about using this function. I find a lot of posts where it is used like

glDeleteTextures(1, &textureName);

However, in Android the function doesn't accept an int as the second parameter but an IntBuffer.
What is an IntBuffer? How can I just pass a single texture name for deletion to this function?
DannyG
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Dec 10, 2010 2:56 pm

Top

Re: glDeleteTextures

Postby ryanm » Thu Dec 16, 2010 1:07 pm

ByteBuffers and related subtypes (FloatBuffer, IntBuffer, ShortBuffer, etc) are how data (vertex position, colours, texCoords, normals, texture data) is passed to OpenGL.

In this instance, what you want to do is
Code: Select all
IntBuffer ib = ByteBuffer.allocateDirect( 4 ).order( ByteOrder.nativeOrder() ).asIntBuffer();
ib.put( 0, texID );
glDeleteTextures( 1, ib );
ryanm
Freshman
Freshman
 
Posts: 3
Joined: Tue Nov 23, 2010 5:51 pm

Re: glDeleteTextures

Postby mark@project8games.com » Thu Dec 16, 2010 5:40 pm

You can also use gl.glDeleteTextures(int, int[], int) to delete a texture by id (just give it a one element array for the second arg)
User avatar
mark@project8games.com
Developer
Developer
 
Posts: 41
Joined: Tue Mar 02, 2010 8:33 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 9 guests