Advertisement

Is there a PICK function.

Started by October 24, 2000 01:27 PM
6 comments, last by JizzRoy 24 years ago
A function that allows you to select objects with the mouse? in GLUT or otherwise. My teacher says there is some utility that does this. I have not found it.
u have a teacher who knows opengl? thats cool.
well, there is an option of doing this, it is called the selection buffer, this actually a rendering mode.
to use it (ill just write the general idea)_

switch to selection mode rendering.
create a small viewfrustum(projection matrix).
translate it to the mouse position.
render the scene, but name each primitive before drawing it.
switch back to normal rendering.
when switching back, ull get the number of primitives that where drawn inside the view-frustum, than search the selection buffer for the names of the primitives been clicked.

thats it, look in the super bible book, or in the red book for the code, or say, and ill write the code for u here.


Advertisement
Thanks for the tip, I have the superbible so I''ll look there. THANKS!
Thanks for the tip, I have the superbible so I''ll look there. THANKS! Just didn''t know what it would be called and he referred to it as the PICK function
I''ve had selection buffer problems with a Voodoo3. You might also want to investigate the color algorithm described in the Red Book. I''ve written an article on www.cornflakezone.com entitled Eeny-Meeny-Miny-Mo=Selection and code which implements it for a list of elements.

Enjoy,



http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//
yes, i have heard of the color algorithm, and maybe the problems u had with your voodo3 card, has something to do with your drivers, since my friend wrote a program that makes use of the selection buffer, and he has voodo3.
Advertisement
I think you''re right, my drivers got screwed up when I tried to install the latest ones. Any ideas how I can roll them back to a version that works with OpenGL correctly?
Use regedit and look in the registry for:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers

Obviously, if you're not using NT you'll have a different windows version listed. Use the 'find' in the menu and search for "OpenGLDrivers".

In the key folder you should see the file name of the OpenGL ICD, replace it with the version you want.

BE CAREFUL THOUGH!

As an aside, people often say that the selection buffer is too slow. If you use it properly that doesn't have to be the case. Only go into selection mode on MouseUp and remember to turn off texture rendering...

Edited by - Pauly on October 26, 2000 3:37:52 PM
Paul Grovespauls opengl page

This topic is closed to new replies.

Advertisement