Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411679 Posts in 69399 Topics- by 58453 Members - Latest Member: Arktitus

May 17, 2024, 11:25:17 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Efficient OpenGL Picking
Pages: [1]
Print
Author Topic: Efficient OpenGL Picking  (Read 1268 times)
amro
Level 0
**


View Profile
« on: April 01, 2010, 08:54:59 AM »

I'm using GL's picking mechanism for interaction with 3D objects. For performance reasons, the pointers to objects to render are stored in a linked list, which means no random access. This means I can't pass an index to glPushName() unless I copy the elements to an array first.

Initially I tried simply passing the pointer to glPushName() which worked super fast, but the problem is that it obviously won't work on 64-bit systems. Does anyone have a good efficient way of handling this? Or perhaps a more suitable container than LL? (I do lots of insertions and deletions).
Logged
Zaphos
Guest
« Reply #1 on: April 01, 2010, 07:38:56 PM »

You could still use each object's position in the list (ie the index) as long as the position doesn't change between glPushName and reading it back.  You would have to traverse the list one extra time to access the picked item using the index, but I doubt it'd be a big performance problem, especially if you only want to pick one thing per frame (eg whatever's under the mouse).

If the object's position will change between glPushName and reading it back, you can just store what the index was at the time of glPushName in the object as its id.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic