Jump to content
  • Advertisement
Sign in to follow this  
neomax

OpenGL Is there any object selection mode in DirectX (like GL_SELECT render mode)?

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

I do mean the stuff like like glPushName, glPopName in OpenGl, where name stack is used during selection mode to allow sets of rendering objects to be uniquely identified: All primitives that would have been drawn near the cursor are identified and stored in the selection buffer (the perfomance issue is that in selection mode the drawing is restricted to a small region of the viewport near the cursor and thus the amount of calculations is dramatically reduced during rendering, since camera “views” only small area around the center of a picking region). After ending rendering the buffers containing names is read back in order to find out what objects are under cursor. Is there anything like this in DirectX?

Share this post


Link to post
Share on other sites
Advertisement
No, there's no such thing in Direct3D because it's not really a "Graphics API" thing. However, there are some utility functions in D3DX to help with this (D3DXIntersectTri or something similar).

What you're looking for is called "Picking", and there are some tutorials that cover it. A couple of tutorials can be found here (look in the articles section).

Share this post


Link to post
Share on other sites
for pixel-perfect picking, you can use colors. set unique colors to objects and then render them to a texture or to screen then take mouse position and just read pixel, compare unique colors of objects, which is not shown (masked). but so you have to draw the clickable objects twice. maybe you want to use more efficient picking method, using bounding boxes/spheres and rays. "introduction to dx game programming" book has good examples of that. hope helps.

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!