Jump to content
  • Advertisement
Sign in to follow this  
akuda

OpenGL realtime picking method

This topic is 4479 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, Here's the link for discussion in OGL forum: http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=3;t=014540 And here's the topic: I need a fast (for realtime) selection mechanism (picking). "Unique colors" method sounds most appropriate. Here's a description of this method: http://gpwiki.org/index.php/OpenGL_Selection_Using_Unique_Color_IDs But then it came up, that if antialiasing is forced, color map (for picking) would be changed, and whole method is unsure. I have two questions: 1. Is it possible to (somehow) prevent AA in buffer I'm rendering to, even if driver is forcing it? I mean, does the driver force the AA to *every* buffer, or to just the one (or two), that will be visible on screen. Can I specify them? Is it possible to render the scene *somewhere* in memory, that driver wouldn't modify it? 2. If not, and this method is always unsure, can anyone recommend me any other method, that would be fast enought for gaming, even if there will be (in maximum program load) only few frames per second (and may be more than one mouse events for each)?

Share this post


Link to post
Share on other sites
Advertisement
you could try turning off any shading, dithering, lightning and texturing, wouldnt that turn off any AA as well?

Share this post


Link to post
Share on other sites
Of course disabling light, texture and fog is a must for this method, but unfortunatley, it doesn't seems to change anyway to antialiasing...

Share this post


Link to post
Share on other sites
Quote:
Original post by akuda
Of course disabling light, texture and fog is a must for this method, but unfortunatley, it doesn't seems to change anyway to antialiasing...


what about:

GLShadeModel(GL_flat);
GLDisable(GL_DITHER);

this might work :/

but why arent you using the built-in picking functionality?

Share this post


Link to post
Share on other sites
Ummmh
wouldn't the method: Project a mouse ray into 3d scene and detect ray interesection with objects yourself using Math.

..be a lot faster than using the glpicking and colorpicking stuff?
Especially for Realtime gameing? (most fps games do this...(think of bullets))

That method is harder work for you as a programmer to code, but once done is just some CPU cycles.
wheras the glpicking/colorpicking stuff takes extra rendering passes in addition...and they're a lot less accurate...

Share this post


Link to post
Share on other sites
Less accurate, perhaps, but if you're selecting from pixel coordinates it would actually be bad to select from a ray instead of from pixels. If the user selects the very edge pixel of something, you have a 50/50 chance of missing with rays, right?

GL_SELECT does take one extra quickee "render" (but no buffer except the selection buffer is changed - and that is just a block of data recording hits, not image data) of things you are interested in selecting. If you maintained a nicely sorted scenegraph and/or used a bounding boxes preliminary check, I suppose you could do it faster with rays than selection. Otherwise you would still have to check all the objects. But wouldn't the GL_SELECT computations run faster on the GPU than the ray computations on the general-puropse CPU? Perhaps you would have to instead ask if your program is cpu or gpu-bound.

But I'm a bit fuzzy on just how much cpu/gpu time each of the methods actually takes.

Quote:
but why arent you using the built-in picking functionality?


Well, I agree with that, but the tutorial did say this:

Quote:
This method can not only be applied to OpenGL apps, but to DirectX apps as well. For the sake of this tutorial, the code given below will be using OpenGL.

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!