View Full Version : Bezier surface glEvalMesh2 question

02-24-2009, 01:23 AM
Hi guys,

I'm trying to draw a colored bezier surface. I have no issue whatsoever drawing my bezier surface using the pseudocode below:

glMap2d( GL_MAP2_VERTEX_3, ..... );
glEnable( GL_MAP2_VERTEX_3 );
glMapGrid2d( .... );
glEvalMesh2(GL_FILL, ....);

My question is this. Can I have each control point have a certain color that is blended in-between to show a multi-colored surface.

In other words, suppose i have a 5x5 grid of control points. I'll end up with 25 control points on my surface. I want each of these control points to have a specific color and it is blended with the colors of neighbouring control points.

I have this is possible.

Do reply.

Thank-you in advance.

02-24-2009, 02:01 AM
Looked at the redbook examples?

Evaluators are deprecated, btw.

02-24-2009, 07:19 PM
Hi modus,

Yea i did look at the redbook examples. But I can't find one where each control point has a different color. Do you have a specific example in mind?


02-25-2009, 10:41 AM
That should be as simple as reading the manual for glMap2f(). ;-)
Same procedure as your glMap2d( GL_MAP2_VERTEX_3, ..... ); and glEnable( GL_MAP2_VERTEX_3 ); calls.
Just add another glMap2f() call with target GL_MAP2_COLOR_4 and the proper values in that grid, plus glEnable( GL_MAP2_COLOR_4).
(I'd recommend using floats.)

02-25-2009, 06:37 PM
Hi relic,

thank you for your reply. That's exactly what i needed. :)