Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:44:41+00:00 2026-05-24T02:44:41+00:00

I am programming in Xcode / OpenGL and have some 3d objects displayed in

  • 0

I am programming in Xcode / OpenGL and have some 3d objects displayed in my view.
Is there a way I can retrieve in OpenGL the 3D location / vertex / face I clicked on ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:44:42+00:00Added an answer on May 24, 2026 at 2:44 am

    The usual way to do this is by calling gluUnProject twice, with your x and y coordinates in both cases, and znear in one, and zfar in the other case.

    That gives you two points through which a ray goes. Your mouse click is on that ray.

    Now collide objects (first bounding volumes, then per triangle if you want, or parametrically if possible) with that ray. The closest hit is the one you want.

    A different possibility would be to read back the z-buffer value (glReadPixels). This should be done with a pixel buffer object and spread over several frames (or it will be a very nasty stall on your pipeline). That will give you a 3D coordinate, for which you can find the closest object.

    Or, you could use occlusion queries (redrawing a 1×1 viewport with color writes disabled) for the same effect.

    Lastly, there is of course selection mode, but this is deprecated functionality, so you will probably not want to use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi there I am new to C programming and have been using Xcode to
I have done quite some xCode programming and found the overview perspective of the
Hey there, I'm a designer thats really new to programming with xcode or Objective-C
Ok, I'm programming in objective-C and using Xcode. I have read through the documentation
Generally in the xcode programming, we can set Font to Labels,TextFields and many more.
The last GUI programming I have done was with Visual Basic, which included objects
I'm new to Xcode and objective C programming and I'm having some troubles building
I'm new to xcode and cocoa. According to the Framework Programming Guide , there
I'm trying to follow along with some tutorials on the web on Xcode programming.
When programming and looking at all different apps I have realized that some apps

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.