Jump to content
  • Advertisement
Sign in to follow this  

Requesting a new tutorial.

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

Okay, I'm very interested in learning how to use opengl mouse selection. The information on the web is very confusing to me. It would make it easier to understand if someone could modify the code from one of the existing tutorials to demonstrate this feature. I think other people would appreciate it as well. If anyone is up to the challenge, I would suggest using Lesson 5 - 3d Shape. I really don't care about what it does after the shape is selected, but there should be something to signify that it has been selected.

Share this post

Link to post
Share on other sites
That is a good request, I think we're going to write a tutorial on that within the new series (hope you all read them [wink]). But first we want to have key input, texturing and vbos there.

But the best way to do mouse selection is the following:
- draw all selectable things in different colors ( you have 255*255*255 possibilities so that should be enough ^^)
- store a list which object is painted in what color
- perform a glReadPixels operation at the mouse position so you get the color the mouse is pointing at
- lookup which object that was
- clear all buffers
- render your scene with the common settings

This should do the trick..


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!