struct Point{
float x;
float y;
};
Using this struct I made 4 points, and assigned them values. The instances of the Points
are then used to create the lines shown in the picture.
PO.x = -0.5f;
PO.y = 0.5f;
P1.x = -1.0f;
P1.y = -0.5f;
Q0.x = 0.5;
Q0.y = -1.0f;
Q1.x = 0.7f;
Q1.y = 0.1f;
glPushMatrix();
glLineWidth(2.5);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINES);
glVertex2f(PO.x, PO.y);//PO
glVertex2f(P1.x, P1.y);//P1
glVertex2f(Q0.x, Q0.y);//QO
glVertex2f(Q1.x, Q1.y);//Q1
glEnd();
glPopMatrix();
The dotted lines should be the transition from points P0 to Q0 and so fourth.
What I do understand is the concept of this technique, LERP, creates in-between frames between the two lines (or Key frame). What I do not understand is how it works.
x = x_start + ((x_final - x_start) * time)// where time is a value between zero and one
The above is the formula for this technique, but how will I implement this into my glut application?
Could not find any sources online that use GLUT and LERP to demonstrate animation.