I am making a simple 2d drawing program in which i have an array of vertices(say a1,a2,a3,.....) which is to be drawn using GL_LINE_STRIP .Problem is that , say there are 3 consecutive vertices : p1, p2, p3, now i want that if (p2==some specfic vertex value) then the GL_LINE_STRIP should end at p1 and a new GL_LINE_STRIP start at p3, ignoring p2. I want to make a break at p2 in the strip. How do i do that?? PS: I tried making (line width = 0 at p2 in the loop of line strip but found out that since opengl is a state machine, we cant change width inside glBegin and GLEnd. any other alternative guys???
HERE IS SOME FAILED SAMPLE CODE:
GLfloat thickness;
glBegin(GL_LINE_STRIP);
for(int i = 0; i < points.size(); i++)//points has all vertices stored...points is an array where each element is a structure containing x and y values
{
if(points[i].x==randomPoint.x || points[i-1].x==randomPoint.x){//checking if it is equal to p2(i am only checking x coordinate,which is sufficient for me to know that this point is to be excluded)
thickness = 0;
}else {
thickness = 4;
}
glLineWidth(thickness);
glVertex2i(points[i].x, points[i].y);
}