jason white
jason white

Reputation: 711

iOS Coco2D Error

This piece of code generating errors when I hit the Action method which added a CCSPrite, hook and I override the Hook to draw a line attached to the hook.

    -(void)Action
{
 // Create the hook
Hook *hook = [Hook spriteWithTexture:[[CCTextureCache sharedTextureCache]   textureForKey:@"hook2_small.png"]];
 hook.position = ccp(self.fishToCatch.position.x, self.fishToCatch.position.y - 10);
  [self addChild:hook];


// Create appropriate move and move finished actions for hook and fish
 id fishMove = [CCMoveTo actionWithDuration:0.5 position:ccp(200, 433 - self.fishToCatch.contentSize.height/2)];
 id fishMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];
id updateScore = [CCCallFuncN actionWithTarget:self selector:@selector(updateScore:)];


 id hookMove = [CCMoveTo actionWithDuration:0.5 position:ccp(200, 433 - self.fishToCatch.contentSize.height/2 - 10)];
id hookMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];

 // Run the actions
 [hook runAction:[CCSequence actions: hookMove, hookMoveDone, nil]];
 [self.fishToCatch runAction:[CCSequence actions: fishMove, fishMoveDone, updateScore, nil]];

[[SimpleAudioEngine sharedEngine] playEffect:@"splash.mp3"];
 self.fishToCatch = nil;
}

The Hook is CSprite and I overrided the draw method

 @implementation Hook

 - (void)draw
  {

   [super draw];
   glEnable(GL_LINE_STRIP);
   glLineWidth(1.0);

   ccDrawColor4F(14.0/255.0,118.0/255.0,188.0/255.0,1.0f);

   ccDrawLine(ccp(self.contentSize.width - 15, self.contentSize.height), ccp(253 - self.position.x,459 - self.position.y));

   // ccDrawLine(ccp(0,0), ccp(100, 100));

  }
 @end

The errors I am seeing are

OpenGL error 0x0500 in -[CCGLView swapBuffers] 280
OpenGL error 0x0500 in -[CCGLView swapBuffers] 280
OpenGL error 0x0500 in -[CCGLView swapBuffers] 280
 OpenGL error 0x0500 in -[CCGLView swapBuffers] 280
OpenGL error 0x0500 in -[CCGLView swapBuffers] 280
OpenGL error 0x0500 in -[CCGLView swapBuffers] 280
 OpenGL error 0x0500 in -[CCSprite draw] 532
OpenGL error 0x0500 in -[CCSprite draw] 532
OpenGL error 0x0500 in -[CCSprite draw] 532

Upvotes: 0

Views: 877

Answers (1)

CodeSmile
CodeSmile

Reputation: 64477

glLineWidth() is an OpenGL ES 1.1 function. If you're using cocos2d 2.x it could explain the OpenGL errors. You can't use OpenGL ES 1.1 functions in an OpenGL ES 2.0 app.

Upvotes: 1

Related Questions