PDA

View Full Version : bezier surfaces



courious
09-25-2002, 07:28 AM
Good day opengl people!
I have trouble with bezier!!
I prepare a array of points[512][512][3]
now i dont know how to set up the glMap2 function and glEvalMesh to read that array....
I did several test but the only one that display something but not wath i want is the following commands lines:
glMap2f(GL_MAP2_VERTEX_3,
0.0f,1.0f,
3, //Is right?Each trhee elements i have 1 u?
4,//Is right? 4=dimension+1?
0.0f,1.0f,
3*512,//is right? Each 512*3 i have 1 v?
4,//is right?dimension+1?
&points[0][0][0]);
glEnable (GL_MAP2_VERTEX_3);
glMapGrid2f(10,0.0f,1.0f,10,0.0f,1.0f);
glEvalMesh2(GL_FILL,0,512,0,512);

If i have an array of points[512][512][3]
how can i do that that array become the control point array? i want to do that all those points control a surface... i hope someone can replay to me and did still read a lot of tutorials but no way for me to understand perhaps because my mother speech is italian too...i really need help if someona would give me some example very very explicatifs...thanks to all good day to you!

Relic
09-26-2002, 02:04 AM
glMapGrid2f(10,0.0f,1.0f,10,0.0f,1.0f);
glEvalMesh2(GL_FILL,0,512,0,512);

I find these suspicious.
You map an integer range of 10 steps from 0.0 to 1.0 in u and v, but evaluate from 0 to 512. Normally the gridsizes are the same for both calls to use the whole control points grid for the iteratioin from 0.0 to 1.0.

Have a look at the RedBook example bezmesh.c (you'll find it on the net).