PDA

View Full Version : how to make a scan line.



nok
01-25-2003, 11:19 PM
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

kehziah
01-27-2003, 01:19 PM
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?

mikael_aronsson
01-27-2003, 11:34 PM
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();
}

nok
01-27-2003, 11:44 PM
thank you for your help. I wanted to implement plane sweep algorithm to find intersection points and simulate it.

fuyu
11-03-2003, 08:14 AM
yes, i wanted to see the coding of sweep algorithm too. please help