#include <Windows.h>
#include <gl\glut.h>
#include<math.h>
#define PI 3.14
void myDisplay2(){
//画两个顶端的圆形区域
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
glBegin(GL_TRIANGLE_FAN);
glVertex3d(0.0,0.0,1.0);
double c = PI/180;
float z = sin(c*80);
float x,y;
for(float theta =-180.0;theta<=180.0;theta+=20.0){
GLfloat thetar = theta*c;
x= sin(thetar)*cos(c*80);
y= cos(thetar)*cos(c*80);
glVertex3d(x,y,z);
}
glEnd();
//画两个顶端的圆形区域
glBegin(GL_TRIANGLE_FAN);
glVertex3d(0.0,0.0,-1.0);
z = -sin(c*80);
for(GLfloat theta =-180.0;theta<=180.0;theta+=20.0){
GLfloat thetar = theta*c;
x= sin(thetar)*cos(c*80);
y= cos(thetar)*cos(c*80);
glVertex3d(x,y,z);
}
glEnd();
for(float phi=-80;phi<=80;phi+=20){
float phir = c*phi ;
float phir20 = c*(phi+20) ;
glBegin(GL_QUAD_STRIP);
for(GLfloat theta =-180.0;thet
[OpenGL]计算机图形学实验01:一个简单的球体
最新推荐文章于 2024-01-14 23:51:42 发布