Objective-C: how to allocate array of GLuint
        Posted  
        
            by sashaeve
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by sashaeve
        
        
        
        Published on 2010-06-09T08:47:08Z
        Indexed on 
            2010/06/09
            9:12 UTC
        
        
        Read the original article
        Hit count: 248
        
I have an array of GLuint with fixed size:
GLuint textures[10];
Now I need to set a size of array dynamically. I wrote something like this:
*.h:
GLuint *textures; 
*.m:
textures = malloc(N * sizeof(GLuint)); 
where N - needed size.
Then it used like this:
glGenTextures(N, &textures[0]);
// load texture from image
-(GLuint)getTexture:(int)index{
    return textures[index];
}
I used the answer from here, but program fell in runtime. How to fix this?
Program is written on Objective-C and uses OpenGL ES.
© Stack Overflow or respective owner