How to get the vertex information of each Bezier patch from Control points???

I’ve known the control points, and by the code below I can surely draw a curve surface by Bezier patches, but here I do want to get each Bezier patches’ details such as each vertex information, normal, and the such. Can you tell me How to obtain these parameters in OpenGL? Thanks a lot!!!
My code :
glEnable(GL_MAP2_VERTEX_3);
glMap2f( GL_MAP2_VERTEX_3, 0.0, 1.0, 4, 4, 0.0, 1.0, 16, 4, @ControlPoints[0][0][0]);
glMapGrid2f(4, 0.0, 1.0, 4, 0.0, 1.0);
glEvalMesh2( FillMode, 0, 4, 0, 4);
How can I get each Bezier patch’s vertex information??? :confused:

Hi !

glu is pretty crappy if you want to do anything but render your beziers, it does not have any callback support so that you cannot get the vertex information.

You could download the SGI OpenGL sample implementation or Mesa and use the GLU code from there and modify it for your own needs though.

I do not think there is any way to get normal/vertex information from the standard GLU functions.

Mikael

you’re going to have to evaluate the parametric equation yourself given the control points.

There’s no way to obtain the info from OpenGL.

maybe this will give you a glimpse into what’s going on under the hood:
http://www.gamedev.net/reference/articles/article1584.asp

Hello Phiphy,

While there’s no way to get vertex normals directly, you can get vertex positions, colors, and texture coordinates via OpenGL’s feedback mechanism. From the vertex positions, along with the GL_POLYGON_TOKEN grouping, you could derive the vertex normals as you would for any mesh.

Here’s the rub on feedback:
http://fly.cc.fer.hr/~unreal/theredbook/chapter12.html

You may find it more convenient/efficient in the end to generate the mesh yourself, as mentioned, or in advance using feedback, then render it with triangles/tri-strips. That is, if the mesh is static, there’s no need to evaluate it continuously.

I thought this was worth mentioning.

By the way, you should use GL_MAP2_VERTEX_4 if you’re sending 4 component vertex positions :wink: