Reputation: 409
Let us say, I draw 3 points with glVertex3f at (0,0,0), (9,0,0) and (10,0,0) I would like to clear all Vertex3f points in the bounding box region (2,-1,-1) to (15, 1, 1) which should include the last two points.
How does one do this in OpenGL?
Upvotes: 0
Views: 313
Reputation: 4641
Manage your point drawing outside of OpenGL. IE Don't use OpenGL to accomplish this. OpenGL is used for drawing data, not keeping track of it. If you want to get rid of certain objects, don't tell OpenGL to draw them. There are various space-partitioning data structures at your disposal for efficiently finding intersections.
The naive way is to check to see that all the points in your scene are outside that region before you draw them.
A better way is to use a kd-tree or an octree to exponentially narrow down the number of comparisons you must do.
Upvotes: 2