Page 1 of 1

Clipping problem with DrawLine

PostPosted: Nov 13, 2002 @ 5:24pm
by adde
Ok. I'm trying to write a VRML viewer using PF and I get the following problem with the DrawLine() function:

Everytime the line starts/ends outside the window, it get's distorted, ie: the clipping code doesn't do what it's suppose to do.

This fenomenon only occurs at the top and bottom of the window. Lines that end/start outside the window to the left or right is calculated correctly and just get cut off.

If you look closely, you can figure out that the lines that end/start outside the top of the window are drawn in the wrong direction from the point not outside the window. That is: It starts in the endpoint inside the window, has the right angle, but wrong direction.

The lines outside the bottom have yet another fault that I can't think of an easy way to explain.

I've looked at the code for DrawLine and found that is has it's own clipping calculator code based on an algoritm called Cohen-Sutherland. Has this somehow been wrongly implemented or is the error someplace else??

I've tried to resize the window back to 320x240 (running a h/pc so I have the PF window in 400x400) but the same thing happens.

Has anyone stumbled across this before, and how did you get past it??

It shure would be nice if the clipping worked as it should. Keeping track of all the line endpoints in a big VRML graph is not something you want to worry about.

PostPosted: Nov 13, 2002 @ 6:18pm
by Kzinti

Strike two

PostPosted: Nov 13, 2002 @ 8:30pm
by adde

Strike two

PostPosted: Nov 13, 2002 @ 10:04pm
by Kzinti