PDA

View Full Version : 2 questions



Coconut_Crab
11-19-2004, 02:36 PM
Question #1

gluProject() takes a vertex's 3D coordinate and calculates its raster(window) coordinate.

I am wondering, is there a function to calculate just the vertex's 2D coordinate from its 3D coordinate, and then another function to transform the 2D coordinate to raster coordinate?

Question #2

If I draw a rectangle while giving a different color to its 4 vertexes, OpenGL can do the beautiful linear interpolation of colors for this rectangle.

Is there a function that does linear color interpolation in the 2D space instead of 3D, in OpenGL? I mean, is there such a function in OpenGL, that if I give 4 raster coordinates with 4 different colors, this function can also draw the rectangle with color interpolation among all the 4 points?

Thank you in advance for your help.

Jack

Korval
11-19-2004, 03:11 PM
There's no such thing in OpenGL as "raster coordinates". If you want to operate in pixel space (specifying vertices in windowing coordinates, like 640x480), you can set that up with a simple matrix transform. You can even use an ortho projection to do this.