Sign in to follow this  
juanpablo56

deleting primitive

Recommended Posts

You can either capture them using classes or variables. For example :

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 program
points.remove( std::find(points.begin(), points.end(), Point2D(20,20) );


It just gives you and idea.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this