100 likes | 309 Views
Selection & Picking in OpenGL. Seung-Hyun Yoon 3D Modeling and Processing Lab. Selection Buffer. Set up Pick Buffer. Selection Buffer: user specified integer array. glSelectBuffer( int size, int *pBuffer );. Initialize Name Stack. stack pointer. Name Stack. Set up Pick Buffer.
E N D
Selection & Picking in OpenGL Seung-Hyun Yoon 3D Modeling and Processing Lab.
Selection Buffer Set up Pick Buffer Selection Buffer: user specified integer array glSelectBuffer( int size, int *pBuffer );
Initialize Name Stack stack pointer Name Stack Set up Pick Buffer glRenderMode( GL_SELECT ); glInitNames();
Specify a Pick Volume Pick Volume Set up Pick Buffer Initialize Name Stack gluPickMatrix( x, y, 5.0, 5.0, viewport );
Draw Object with IDs 1 0 0 100 Fill Selection Buffer Set up Pick Buffer Initialize Name Stack Specify a Pick Volume glPushName(100); glDrawRedRect();
1 0 0 100 2 0 0 100 200 Fill Selection Buffer Set up Pick Buffer Initialize Name Stack Specify a Pick Volume Draw Object with IDs glPushName(200); glDrawGreenRect();
1 0 0 100 2 0 0 100 200 Fill Selection Buffer Set up Pick Buffer Initialize Name Stack Specify a Pick Volume Draw Object with IDs glPushName(300); glDrawBlueRect();
Post Processing Post Processing Set up Pick Buffer Initialize Name Stack Specify a Pick Volume Draw Object with IDs gRenderMode( GL_RENDER ); Do anything you want !!!