• Advertisement
Sign in to follow this  

simple variable question

This topic is 1918 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am getting a "left" ambiguous variable error. I am trying to move a breakout paddle left. I was told not to use global variables but then I am unsure of how to tackle this problem. I will do more research on functions and global variables.

void paddle_left(void)
{
//draw paddle
glBegin(GL_QUADS);
glTexCoord2f(-1.0f, 0.0f);
glVertex3f(-1.0+left, -4.5f, 0.0f);
glTexCoord2f(-1.0F, 1.0f);
glVertex3f(1.0f+left, -4.5f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(1.0f+left, -5.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1.0+left, -5.0f, 0.0f);
glEnd();
left-=1;
}

I am using texture mapping to draw the paddle.

Share this post


Link to post
Share on other sites
Advertisement
From what I can tell, you need to either have the variable left, as a global, or if you dont want to do that, you need to pass in the variable for 'left' as a parameter....

void paddle_left(float left)
{
....
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement