Jump to content

  • Log In with Google      Sign In   
  • Create Account


some puzzles about using glkTextureinfo


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 gaoy   Members   -  Reputation: 104

Like
0Likes
Like

Posted 23 April 2014 - 01:28 AM

Hi. 

All. 

 

now i am using glktextureinfo,  to load some picture from different path. But it seems that i could only load the image successfully for the first time. And while i give the path, a different location for the next image, it could not be load successfully. Anyone have met the similar case before. i have listed the related code below. 

 

@property (strong, nonatomic) GLKTextureInfo *info;
@property (strong, nonatomic) EAGLContext *context;
@property (strong, nonatomic) GLKBaseEffect *effect;

 

- (void)setupGL
{
    [EAGLContext setCurrentContext:self.context];
 
    // load the input image as a texture
    NSError *error;
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],GLKTextureLoaderOriginBottomLeft, nil];
    
    NSString *imageName = [NSString stringWithFormat:@"%d",_index]; //_index has been defined before, and could be modified by users.
    NSString *path = [[NSBundle mainBundle] pathForResource:imageName ofType:@"png"];
   
    self.info = [GLKTextureLoader textureWithContentsOfFile:path options:options error:&error];
       
    _imageTexture = self.info.name;
    _imageW       = self.info.width;
    _imageH       = self.info.height;
 
}
 
 
- (void)tearDownGL
{
    glDeleteTextures(1, &_imageTexture);
    [EAGLContext setCurrentContext:self.context];
    self.effect = nil;
    self.info = nil;
    seledit_destroy(_selEditContext);
}
 
 
while the program found that it need to load another image from other path, i will implement as below shows,
 
if(_next)
{
      [self tearDownGL];
      [self setupGL];
}
 
But it seems that i i could not run it successfully. 
So, how could i solve this?
 
 

Edited by gaoy, 23 April 2014 - 01:30 AM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS