3D surface inaccurate
i used the following code to draw 1/4 of cylinder surface but it doesn't seem accurate. Anyone can point out the problem? Also as it is a meshed surface, how do i fill it? (d is radius of cylinder)
GLint nNumPoints=3;
GLfloat ctrlPoints[3][3][3]={{{-d,0.0f,1.0f},
{-0.7071f*d,-0.7071f*d,1.0f},{0.0f,-d,1.0f}}, //v=0
{{-d,0.0f,0.0f},{-0.7071f*d,-0.7071f*d,0.0f},
{0.0f,-d,0.0f}}, //v=1
{{-d,0.0f,-1.0f},{-0.7071f*d,-0.7071f*d,-1.0f},
{0.0f,-d,-1.0f}}};//v=2
// the setup function
glMap2f(GL_MAP2_VERTEX_3, // Type of data generated
0.0f, // Lower u range
10.0f, // Upper u range
3, // Distance between points in the data
3, // Dimension in u direction (order)
0.0f, // Lower v range
10.0f, // Upper v range
9, // Distance between points in the data
3, // Dimension in v direction (order)
&ctrlPoints[0][0][0]); // array of control points
// Enable the evaluator
glEnable(GL_MAP2_VERTEX_3);
// Map a grid of 100 points from 0 to 100
glMapGrid2f(10,0.0f,10.0f,10,0.0f,10.0f);
// Evaluate the grid, using lines
glEvalMesh2(GL_LINE,0,10,0,10);
glEnable(GL_AUTO_NORMAL);
[edited by - coda_x on January 13, 2004 4:25:30 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement