May 2017
Intermediate to advanced
982 pages
22h 42m
English
Often when working on projects, we need the ability to pick graphical objects on screen. While in OpenGL versions before OpenGL 3.0, the selection buffer was used for this purpose, this buffer is removed in the modern OpenGL 3.3 core profile. However, this leaves us with some alternate methods. We will implement a simple picking technique using the depth buffer in this recipe.
The code for this recipe is in the Chapter2/Picking_DepthBuffer folder. Relevant source files are in the Chapter2/src folder.
Picking using depth buffer can be implemented as follows:
glEnable(GL_DEPTH_TEST);
Read now
Unlock full access