PDA

View Full Version : Triangle rendering



IG
12-18-2005, 07:42 AM
Need some help please:
when I'm tring to render a triangle that creats almost a line it can not be seen, for example:
glBegin(GL_TRIANGLES);
glVertex2f(100.0f, 100.0f);
glVertex2f(200.0f, 200.0f);
glVertex2f(300.0f, 301.0f);
glEnd();
Can somebody knows WHY ???
Note: if the last vertex is (300.0f, 302.0f) then I see a half line !!!???

memfr0b
12-18-2005, 04:39 PM
Quoting the Opengl 2.0 Specification (http://www.opengl.org/documentation/specs/version2.0/glspec20.pdf) Section 3.5.1 Basic Polygon Rasterization:



The rule for determining which fragments are produced by polygon rasterization is called point sampling. The two-dimensional projection obtained by taking the x and y window coordinates of the polygon's vertices is formed. Fragment centers that lie inside of this polygon are produced by rasterization.
There are no fragments being generated, because no fragment centers fall into the triangle.

dorbie
12-19-2005, 01:26 AM
The previous reply is correct, but let me add, OpenGL draws polygons accurately, within the limits of sampling. The polygon you drew had zero area on the screen, therefore not seeing anything on screen is the correct and expected behavior.