Hi.
Please help me to understand how OpenGL rasterize triangle.
If I draw to triangles with adjacent edges
glBegin(GL_TRIANGLES);
glColor3f(1.0, 1.0, 1.0);
glVertex3f(5, 5, 0);
glVertex3f(0, 5, 0);
glVertex3f(0, 0, 0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(0, 0, 0);
glVertex3f(5, 0, 0);
glVertex3f(5, 5, 0);
glEnd();
it looks like it use top-left rule.
White triangle occupies 10 pixels and green - 15
But when I change positions
glBegin(GL_TRIANGLES);
glColor3f(1.0, 1.0, 1.0);
glVertex3f(0, 5, 0);
glVertex3f(0, 0, 0);
glVertex3f(5, 0, 0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(5, 0, 0);
glVertex3f(5, 5, 0);
glVertex3f(0, 5, 0);
glEnd();
it looks completely different! Why now white triangle occupies 15 pixels not 10?
screenshot:
Please help me to understand how OpenGL rasterize triangle.
If I draw to triangles with adjacent edges
glBegin(GL_TRIANGLES);
glColor3f(1.0, 1.0, 1.0);
glVertex3f(5, 5, 0);
glVertex3f(0, 5, 0);
glVertex3f(0, 0, 0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(0, 0, 0);
glVertex3f(5, 0, 0);
glVertex3f(5, 5, 0);
glEnd();
it looks like it use top-left rule.
White triangle occupies 10 pixels and green - 15
But when I change positions
glBegin(GL_TRIANGLES);
glColor3f(1.0, 1.0, 1.0);
glVertex3f(0, 5, 0);
glVertex3f(0, 0, 0);
glVertex3f(5, 0, 0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(5, 0, 0);
glVertex3f(5, 5, 0);
glVertex3f(0, 5, 0);
glEnd();
it looks completely different! Why now white triangle occupies 15 pixels not 10?
screenshot: