資源簡介
程序的全部源代碼,壓縮包,可直接打開,VC6.0,c++語言
代碼片段和文件信息
//#include?
#include?“stdafx.h“
#include?
#include???
#include?
using???namespace???std;
static?double?r?=?1;
static?int?number?=?1;
//按三角形帶繪制
void?earth1(double?x0?double?y0?double?z0)
{
double?x?y?z?thet?phi;
//int?nlat?nlong;
double?c;
x?=?x0;?y?=?y0;
z?=?r?+?z0;//球頂坐標
glBegin(GL_TRIANGLE_FAN);
glVertex3d(x?y?z);
c?=?3.14159?/?180.0;
z?=?r*sin(c*80.0);
for?(thet?=?-180.0;?thet?<=?180.0;?thet?+=?5)
{
x?=?x0?+?r*sin(c*thet)*cos(c*80.0);
y?=?y0?+?r*cos(c*thet)*cos(c*80.0);
glColor3f(rand()?/?32767.0?rand()?/?32767.0?rand()?/?32767.0);
glVertex3d(x?y?z);
}
glEnd();
x?=?x0;?y?=?y0;
z?=?-r?+?z0;//球底坐標
glBegin(GL_TRIANGLE_FAN);
glVertex3d(x?y?z);
z?=?-r*sin(c*80.0);
for?(thet?=?-180.0;?thet?<=?180.0;?thet?+=?5)
{
x?=?x0?+?r*sin(c*thet)*cos(c*80.0);
y?=?y0?+?r*cos(c*thet)*cos(c*80.0);
glColor3f(rand()?/?32767.0?rand()?/?32767.0?rand()?/?32767.0);
glVertex3d(x?y?z);
}
glEnd();
for?(phi?=?-80.0;?phi?<=?80.0;?phi?+=?5)
{
glBegin(GL_TRIANGLE_STRIP);
for?(thet?=?-180.0;?thet?<=?180.0;?thet?+=?5)
{
x?=?x0?+?r*sin(c*thet)*cos(c*phi);
y?=?y0?+?r*cos(c*thet)*cos(c*phi);
z?=?z0?+?r*sin(c*phi);
glColor3f(rand()?/?32767.0?rand()?/?32767.0?rand()?/?32767.0);
glVertex3d(x?y?z);
x?=?x0?+?r*sin(c*thet)*cos(c*(phi?+?20.0));
y?=?y0?+?r*cos(c*thet)*cos(c*(phi?+?20.0));
z?=?z0?+?r*sin(c*(phi?+?20.0));
glColor3f(rand()?/?32767.0?rand()?/?32767.0?rand()?/?32767.0);
glVertex3d(x?y?z);
}
glEnd();
}
}
//按四邊形帶繪制
void?earth2(double?x0?double?y0?double?z0)//三角形扇以及四邊形帶
{
double?x?y?z?thet?phi;
//int?nlat?nlong;
double?c;
x?=?x0;?y?=?y0;
z?=?r?+?z0;//球頂坐標
glBegin(GL_TRIANGLE_FAN);
glVertex3d(x?y?z);
c?=?3.14159?/?180.0;
z?=?r*sin(c*80.0);
for?(thet?=?-180.0;?thet?<=?180.0;?thet?+=?20.0)
{
x?=?x0?+?r*sin(c*thet)*cos(c*80.0);
y?=?y0?+?r*cos(c*thet)*cos(c*80.0);
glColor3f(1.0?0.0?0.0);
glVertex3d(x?y?z);
}
glEnd();
x?=?x0;?y?=?y0;
z?=?-r?+?z0;//球底坐標
glBegin(GL_TRIANGLE_FAN);
glVertex3d(x?y?z);
z?=?-r*sin(c*80.0);
for?(thet?=?-180.0;?thet?<=?180.0;?thet?+=?20.0)
{
x?=?x0?+?r*sin(c*thet)*cos(c*80.0);
y?=?y0?+?r*cos(c*thet)*cos(c*80.0);
glColor3f(1.0?0.0?0.0);
glVertex3d(x?y?z);
}
glEnd();
for?(phi?=?-80.0;?phi?<=?80.0;?phi?+=?20.0)
{
glBegin(GL_QUAD_STRIP);//繪制球體四邊形帶?
for?(thet?=?-180.0;?thet?<=?180.0;?thet?+=?20.0)
{
x?=?x0?+?r*sin(c*thet)*cos(c*phi);
y?=?y0?+?r*cos(c*thet)*cos(c*phi);
z?=?z0?+?r*sin(c*phi);
glColor3f(1.0?0.0?0.0);
glVertex3d(x?y?z);
x?=?x0?+?r*sin(c*thet)*cos(c*(phi?+?20.0));
y?=?y0?+?r*cos(c*thet)*cos(c*(phi?+?20.0));
z?=?z0?+?r*sin(c*(phi?+?20.0));
glColor3f(1.0?0.0?0.0);
glVertex3d(x?y?z);
}
glEnd();
}
}
void?earth3(double?x0?double?y0?double?z0)
{
double?x?y?z?thet?phi;
//int?nlat?nlon
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-04-18?18:46??OpenGL_exercise--用三角形畫球--OK\
?????目錄???????????0??2018-03-29?13:53??OpenGL_exercise--用三角形畫球--OK\.vs\
?????目錄???????????0??2018-03-29?13:53??OpenGL_exercise--用三角形畫球--OK\.vs\OpenGL_exercise\
?????目錄???????????0??2018-03-29?13:53??OpenGL_exercise--用三角形畫球--OK\.vs\OpenGL_exercise\v14\
?????文件???????33280??2018-04-18?18:46??OpenGL_exercise--用三角形畫球--OK\.vs\OpenGL_exercise\v14\.suo
?????目錄???????????0??2018-03-29?13:53??OpenGL_exercise--用三角形畫球--OK\Debug\
?????文件??????169984??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Debug\glut.dll
?????文件???????79654??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Debug\glut.lib
?????文件??????169984??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Debug\glut32.dll
?????文件???????79898??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Debug\glut32.lib
?????文件???????74240??2018-03-29?14:01??OpenGL_exercise--用三角形畫球--OK\Debug\OpenGL_exercise.exe
?????文件??????409760??2018-03-29?14:01??OpenGL_exercise--用三角形畫球--OK\Debug\OpenGL_exercise.ilk
?????文件??????945152??2018-03-29?14:01??OpenGL_exercise--用三角形畫球--OK\Debug\OpenGL_exercise.pdb
?????目錄???????????0??2018-03-29?13:53??OpenGL_exercise--用三角形畫球--OK\Inc\
?????文件??????169984??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Inc\glut.dll
?????文件???????21440??1998-08-18?16:24??OpenGL_exercise--用三角形畫球--OK\Inc\glut.h
?????文件???????79654??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Inc\glut.lib
?????文件??????169984??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Inc\glut32.dll
?????文件???????79898??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Inc\glut32.lib
?????目錄???????????0??2018-03-29?13:59??OpenGL_exercise--用三角形畫球--OK\ipch\
?????目錄???????????0??2018-03-29?13:53??OpenGL_exercise--用三角形畫球--OK\ipch\opengl_exercise-4d2c6668\
?????文件?????3080192??2018-03-28?10:38??OpenGL_exercise--用三角形畫球--OK\ipch\opengl_exercise-4d2c6668\opengl_exercise-5e1d0d28.ipch
?????目錄???????????0??2018-03-29?13:53??OpenGL_exercise--用三角形畫球--OK\ipch\OPENGL_EXERCISE-4f58b6\
?????文件?????3538944??2018-03-28?20:45??OpenGL_exercise--用三角形畫球--OK\ipch\OPENGL_EXERCISE-4f58b6\OPENGL_EXERCISE-9fd2e268.ipch
?????目錄???????????0??2018-03-29?13:59??OpenGL_exercise--用三角形畫球--OK\ipch\OPENGL_EXERCISE-e95ad2f9\
?????文件?????3538944??2018-04-18?18:46??OpenGL_exercise--用三角形畫球--OK\ipch\OPENGL_EXERCISE-e95ad2f9\OPENGL_EXERCISE-9fd2e268.ipch
?????目錄???????????0??2018-03-29?13:53??OpenGL_exercise--用三角形畫球--OK\Lib\
?????文件??????169984??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Lib\glut.dll
?????文件???????21440??1998-08-18?16:24??OpenGL_exercise--用三角形畫球--OK\Lib\glut.h
?????文件???????79654??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Lib\glut.lib
?????文件??????169984??1998-08-18?16:25??OpenGL_exercise--用三角形畫球--OK\Lib\glut32.dll
............此處省略33個文件信息
評論
共有 條評論