PDA

View Full Version : Problem of drawing line



wexuv
01-09-2006, 06:07 PM
i draw a line with points (10,10),(100,10) first
,then draw a triangle with points as (10,10),
(100,10),(100,100).Does the triangle cover the line? i have tested this on different video cards and had different results.On intel 82865 card the line draws beside the triangle, and on sis(*) card the line is covered with the triangle.How to resolve this difference?

Code like that:
glBegin(GL_LINES);
glVertex2d( 10.0f, 10.0f );
glVertex2d( 100.0f, 10.0f);
glEnd();

glBegin(GL_TRIANGLE_STRIP);
glVertex3f(10.0f, 10.f, 0.0f);
glVertex3f(100.0f, 10.0f, 0.0f);
glVertex3f(100.0f, 100.0f, 0.0f);
glEnd();

hope you understood my question and give me help.
thanks.

rgpc
01-09-2006, 09:22 PM
That's it! I'm outa here... :mad:

arekkusu
01-09-2006, 11:57 PM
If you are using orthographic projection, and you want predictable rasterization, per the rules in the spec you need to draw points and lines on 0.5 px centers, and triangles/quads/polygons on 0.0 px corners.

Otherwise, the position of the point/line (after mvp projection and viewport transform) may be rounded up or down to the nearest integer pixel, it is implementation dependent which way it goes.

arekkusu
01-10-2006, 12:03 AM
This is also a FAQ. See 14.120 (http://www.opengl.org/resources/faq/technical/rasterization.htm#rast0120) .

wexuv
01-10-2006, 12:12 AM
Cool!!
Thanks arekkusu very much!

dorbie
01-10-2006, 02:04 PM
Please consider that this is an advanced forum and there is another forum for where this would have been a suitable post.

In future please post questions like this only in the beginner's forum.

I'm moving this thread to beginners.