Hi,
Lets say i created two points on 2d world:
glBegin(GL_POINTS);
glVertex3f(20, 20, 0);
glEnd();
glBegin(GL_POINTS);
glVertex3f(50, 50, 0);
glEnd();
How can i erase only one of them while keeping other one?
deleting primitive
You can either capture them using classes or variables. For example :
It just gives you and idea.
struct Point2D{ float _x,_y; Point(float x = 0.0f, float y = 0.0f) : _x(x), _y(y) {}};bool operator == (const Point2D& p1, const Point2D& p2){ return p1.x == p2.x && p2.y == p1.y;}std::vector<Point2D> points;points.push_back( Point2D(20,20));points.push_back( Point2D(50,50));void drawPoint(const Point2D& p){ glBegin(GL_POINTS); glVertex3f(p.x, p.y,0.0f); glEnd();}void draw(){ std::for_each(points.begin(),points.end(),drawPoint);}//somewhere in your programpoints.remove( std::find(points.begin(), points.end(), Point2D(20,20) );
It just gives you and idea.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement