PDA

View Full Version : colour smoothening



Rajveer
04-23-2002, 06:25 AM
Does anybody know (mathematically) how OpenGL smoothens colours across primitives that are drawn. i.e. if I draw a line:

glBegin(GL_LINES);
glColor3f(1.0, 0.5, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glColor3f(0.5, 0.0, 0.3);
glVertex3f(2.0, 0.0, 0.0);
glEnd();

how does it calculate the chosen RGB values all along the line based on the RGB values for the end points? What is the mathematical relationship?
Thanks.

[This message has been edited by Rajveer (edited 04-23-2002).]

Coconut
04-23-2002, 06:28 AM
Originally posted by Rajveer:
Does anybody know (mathematically) how OpenGL smoothens colours across primitives that are drawn. i.e. if I draw a line:

glBegin(GL_LINES);
glColor3f(1.0, 0.5, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glColor3f(0.5, 0.0, 0.3);
glVertex3f(2.0, 0.0, 0.0);
glEnd();

how does it calculate the chosen RGB values all along the line based on the RGB values for the end points? What is the mathematical relationship?
Thanks.

[This message has been edited by Rajveer (edited 04-23-2002).]
This can be explained precisely in the spec of OpenGL such as:
http://www.opengl.org/developers/documen...000000000000000 (http://www.opengl.org/developers/documentation/Specs/glspec1.1/node47.html#SECTION00641000000000000000)