Using GLKTextureLoader to load a texture atlas

234 views Asked by At

I seem to be a little restricted by openGLs GLKTextureLoader. I'm trying to get sprite animation working so I'm trying to load a texture atlas. The texture loader doesn't seem to allow me to break the image into pieces.

This is the relevant code

    NSDictionary * options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],
                              GLKTextureLoaderOriginBottomLeft, nil];

    NSError * error;
    NSString *path = [[NSBundle mainBundle] pathForResource:filename ofType:nil];

    self.textureInfo = [GLKTextureLoader textureWithContentsOfFile:path options:options error:&error];

any thoughts?

1

There are 1 answers

0
Noah Witherspoon On

Why would you need to break the image into pieces? The whole point of a texture atlas is that you can use bits of it just by choosing appropriate texture coordinates to only show part of it.