Jump to content
  • Advertisement
Sign in to follow this  
aeltani

Untitled

This topic is 3608 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

Hi, I want to draw points when I am moving the mouse and pressing a button. But it's not working. I don't have the button or state parameter that I use with glutMouseFunc. I tried adding glFlush and glutPostRedisplay. But when I do that I have a dot that appears when I press and disappear when I release the button. What should I add to this code for it to work. void motionMouse( int x,int y) { printf("X = %d\n",x); glBegin(GL_POINTS); glVertex2i(x,600-y); glEnd(); }

Share this post


Link to post
Share on other sites
Advertisement
You should put all your rendering code in one place. Since you are probably clearing the frame buffer each frame the point disappears. The solution is, instead of rendering the point when the mouse is pressed, to add it to a list of points to be rendered.

HTH.

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!