I have a program that will draw a line as shown below.
private void glControl1_Paint(object sender, PaintEventArgs e)
{
GL.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT);
GL.glMatrixMode(GL.GL_MODELVIEW);
GL.glLoadIdentity();
GL.glColor(Color.Yellow);
GL.glBegin(GL.GL_LINES);
GL.glVertex3f(100.0f, 100.0f, 0.0f); // origin of the line
GL.glVertex3f(200.0f, 140.0f, 5.0f); // ending point of the line
GL.glEnd();
glControl1.SwapBuffers();
}
The method above is called during Paint event.
But I have another method as shown below:
private void glControl1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
GL.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT);
GL.glMatrixMode(GL.GL_MODELVIEW);
GL.glLoadIdentity();
GL.glColor(Color.Yellow);
GL.glBegin(GL.GL_LINES);
GL.glVertex3f(100.0f, 100.0f, 0.0f); // origin of the FIRST line
GL.glVertex3f(200.0f, 140.0f, 5.0f); // ending point of the FIRST line
GL.glVertex3f(120.0f, 170.0f, 10.0f); // origin of the SECOND line
GL.glVertex3f(240.0f, 120.0f, 5.0f); // ending point of the SECOND line
GL.glEnd();
}
I wish to draw something in this method but it didn't work.
What's wrong.
Thanks