for an Android OpenGL app I have some quads which are textured based on a user configuration. If the configuration changes, the textures need to change accordingly. I wrote a function to load these:
After some debugging I found out that the first time, the mTextures array consists of [1, 2, 3]. Every subsequent call sets it to [0, 0, 0], so it seems glGenTextures is having trouble assigning id’s? glGetError() traces 3766488 (after more debugging this seems to be an arbitrary number, therefore gluErrorString returns NULL)
My guess is that I don’t even have to recreate the int[] as the glGenTextures should overwrite the values? (you tell it to offset from 0). Of course the array would contain unused values if the next call would contain less textures, but in my situation there’s always 3 textures.
Im really stumped by the value glGetError returns… it’s like the function is totally broken…
You should definitely recreate the int as otherwise you’re building in an assumption that your value of resources.length is always the same. It may be smaller, it may be larger, and if you ever come to reuse this code you’ll be bitten by it.
As stated it’s true the resources.length is always the same in this case, however I do agree on the reuse part. Though delete[] is not recognized by Eclipse as being a valid java statement.