Sign in to follow this  
TruckMack33

Requesting a new tutorial.

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..

Cheers
Carsten

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this