Jump to content
Posted 21 August 2012 - 04:34 AM
Posted 21 August 2012 - 05:53 AM
I would not recommend it. The reason is that it is based on deprecated legacy OpenGL. It is not the way OpenGL is used any longer. Well, it is obviously still supported, and it is quite easy to get going. There are two common ways to do picking these days. One is to do color picking, and the other is ray tracing.
Do you recommend I use this method?
I'm asking this, because I used it in my project and I have a problem.
Posted 21 August 2012 - 07:07 AM
Posted 21 August 2012 - 07:13 PM
Posted 22 August 2012 - 03:36 AM
Edited by Wilhelm van Huyssteen, 22 August 2012 - 04:06 AM.
Posted 22 August 2012 - 04:33 AM
Posted 22 August 2012 - 05:39 AM
The colour buffer method is *slightly* better, however it's an extremely slow approach compared to rolling your own ray picking algorithms (people always forget that rasterising a tonne of triangles is actually very slow).
Posted 22 August 2012 - 06:16 AM
25ms is nothing to be proud of.
If you have a game running at decent FPS, say 40, then doing a color selection would take at most 1/40=25 ms.
Maybe not, but your physics/audio/networking systems will (and the player will notice problems there pretty quickly).
The player will never notice the 25ms delay.
And you see this as justification to use an inefficient technique?
But there are more complicated use cases, where there are maybe millions of possible hits that have to be tested.
Posted 22 August 2012 - 08:02 AM
Posted 23 August 2012 - 10:06 AM
Posted 24 August 2012 - 09:04 AM
Usually you can get away with ray tracing against a simplified geometry (circles, ellipses, boxes...).
I was also wondering about this. For a game with a lot of selectable objects on screen and where you dont need to know wich triangle is under the cursor only wich object (lets say World of Warcraft) would it be best to use colour picking or ray tracing?
Posted 24 August 2012 - 12:44 PM
No, that is valid. The old ways are the use of glBegin(), glTranslatef(), glColor(), etc. It called "immediate mode", as you define the geometry on-the-fly. The correct way is to use Vertex Buffer Objects (VBO) and Vertex Array Objects (VAO). You will also have to define your own shader. At first glance, it looks much harder. And it is harder, to begin with.Yes, the principles are right, but implemented using deprecated legacy OpenGL.
The Color picking would that be?
What is deprecated? glReadPixels?
Posted 26 August 2012 - 07:14 AM