Jump to content
  • Advertisement
Sign in to follow this  
phil67rpg

simple variable question

This topic is 2096 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!