how to make a scan line.

hi,
I want to make a scan line from top to bottom of the window. I can draw a line but I don’t know how to make it move.
thank you for helping

I’m not sure I understand your question. What kind of effect are you trying to implement? By “scanline”, you mean some kind of laser beam that goes from top to bottom?

Hi !

You can’t make it move…

What you can do is to use a timer or something to update the position of the line and then redraw the whole thing for each update, it’s called animation.

on_timer_event()
{
y = y + 1;
invalidate_or_update_window();
}

draw_opengl_stuff()
{
…setup orthographic view…
glBegin( GL_LINES);
glVertex2d( 0, y);
glVertex2d( win_width, y);
glEnd();
}

thank you for your help. I wanted to implement plane sweep algorithm to find intersection points and simulate it.

yes, i wanted to see the coding of sweep algorithm too. please help