а ты подключил #pragma comment(lib, "Opengl32.lib"); #pragma comment(lib, "GLU32.lib"); pragma comment(lib, "GLaux.lib"); но как я теперь понял что с помощью квадрика не програмят =)
и у меня с
| Цитата(DENNN @ 29.11.2004, 14:02) | | Вот генерация сферы с текстурными координатами. |
проблема:
| Код | /* Create a sphere centered at c, with radius r, and precision n Draw a point for zero radius spheres Use CCW facet ordering "method" is 0 for quads, 1 for triangles (quads look nicer in wireframe mode) Partial spheres can be created using theta1->theta2, phi1->phi2 in radians 0 < theta < 2pi, -pi/2 < phi < pi/2 */ void CreateSphere(XYZ c,double r,int n,int method, double theta1,double theta2,double phi1,double phi2) { int i,j; double t1,t2,t3; XYZ e,p;
/* Handle special cases */ if (r < 0) r = -r; if (n < 0) n = -n; if (n < 4 || r <= 0) { glBegin(GL_POINTS); glVertex3f(c.x,c.y,c.z); glEnd(); return; }
for (j=0;j<n/2;j++) { t1 = phi1 + j * (phi2 - phi1) / (n/2); t2 = phi1 + (j + 1) * (phi2 - phi1) / (n/2);
if (method == 0) glBegin(GL_QUAD_STRIP); else glBegin(GL_TRIANGLE_STRIP);
for (i=0;i<=n;i++) { t3 = theta1 + i * (theta2 - theta1) / n;
e.x = cos(t1) * cos(t3); e.y = sin(t1); e.z = cos(t1) * sin(t3); p.x = c.x + r * e.x; p.y = c.y + r * e.y; p.z = c.z + r * e.z; glNormal3f(e.x,e.y,e.z); glTexCoord2f(i/(double)n,2*j/(double)n); glVertex3f(p.x,p.y,p.z);
e.x = cos(t2) * cos(t3); e.y = sin(t2); e.z = cos(t2) * sin(t3); p.x = c.x + r * e.x; p.y = c.y + r * e.y; p.z = c.z + r * e.z; glNormal3f(e.x,e.y,e.z); glTexCoord2f(i/(double)n,2*(j+1)/(double)n); glVertex3f(p.x,p.y,p.z);
} glEnd(); } }
|
что за double theta1,double theta2,double phi1,double phi2 ? |