xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 252KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2021-05-18
  • 語言: 其他
  • 標簽: openGL??球體??

資源簡介

繪制若干OpenGL基本體素(三角形、三角形帶、四邊形、四邊形帶)構成的球體,注意球體繪制與球體劃分的區別。 ? 可以控制改變球的數量和球的體積,來改變基本體素的數量以及頂點的數量。 ? 可以通過改變glPolygonMode,切換是否填充所繪制的基本體素。 ? 利用函數glutGet(GLUT_ELAPSED_TIME)(returns the time in milliseconds since glutInit or the first invocation of the function)統計繪制時間

資源截圖

代碼片段和文件信息

#include?
#include
#include
#include
#include?
#include?

#define?PI?3.1415926
#define?GLfloat?float
#define?GLdouble?double
#define?GLint?int

double?c=PI/180.0;
double?radius=100.0;//球半徑
int?w=500.0h=500.0;//窗口的寬和高
int?angleX=10angleY=10;//角度
double?oldcenterxoldcenterycenterxcenterycenterz;
int?num=1;
int?fill_mode=GL_LINE;//顯示面只用線表示
double?step=10;
long?timeStart=0;
time_t?t;
int?style=GL_QUAD_STRIP;//四邊形帶
int?color;
color=1;
float?thetaphirphithetarphir20;
float?xyz;
double?c80;
int?i;

void?drawSphere(int?centerxint?centeryint?centerz){

//選擇當前操作的矩陣。GL_MODELVIEW為模型視圖矩陣
glMatrixMode(GL_MODELVIEW);
????//將當前矩陣設置為4乘4單位矩陣
glLoadIdentity();
????//平移變換
glTranslated(centerxcenterycenterz);

????//旋轉變換從(0,0,0)到(0,1,0)逆時針方向旋轉45°
glRotated(45010);
glRotated(angleY100);
glRotated(angleX001);


c80=c*80;

//定義視口,前兩個0為左下角坐標,w和h為視口的寬度和高度
glViewport(00(GLdouble)w(GLdouble)h);

for(phi=-90;phi<=90;phi+=step){
???phir???=?c*phi;
???phir20?=?c*(phi+20);

???//glPolygonMode函數用于控制多邊形的顯示方式。
????glPolygonMode(GL_FRONTfill_mode);//GL_FRONT表示顯示模式將適用于物體的前向面(也就是物體能看到的面)
?????glPolygonMode(GL_BACKfill_mode);//GL_FILL表示顯示面(GL_POINT表示只顯示頂點GL_LINE表示顯示線段)
????????
???//設置CCW方向為“正面”,
???glFrontFace(GL_CCW);
???glBegin(style);
???for(theta=-180;theta<=180;theta+=step){
????thetar?=?c*theta;
????x=radius*sin(thetar)*cos(phir);
????y=radius*cos(thetar)*cos(phir);
????z=radius*sin(phir);
????//隨機分配顏色。
????if(color)
?????glColor3f((rand()%101*1.0)/100(rand()%101*1.0)/100(rand()%101*1.0)/100);
????glVertex3d(xyz);
????x=radius*sin(thetar)*cos(phir20);
????y=radius*cos(thetar)*cos(phir20);
????z=radius*sin(phir20);
????glVertex3d(xyz);
???}
???glEnd();
}


if(style==GL_TRIANGLES?||?style==GL_QUADS){
??

????for(phi=-90;phi<=90;phi+=step){
????phir???=?c*phi;
???
????glPolygonMode(GL_FRONTfill_mode);
????glPolygonMode(GL_BACKfill_mode);
????glFrontFace(GL_CCW);
????glBegin(GL_POLYGON);
????for(theta=-180;theta<=180;theta+=step){
?????thetar?=?c*theta;
?????x=radius*sin(thetar)*cos(phir);
?????y=radius*cos(thetar)*cos(phir);
?????z=radius*sin(phir);
?????//隨機分配顏色。
?????if(color)
??????glColor3f((rand()%101*1.0)/100(rand()%101*1.0)/100(rand()%101*1.0)/100);
?????glVertex3d(xyz);
????}
????glEnd();

????}
}

glPolygonMode(GL_FRONTfill_mode);
glPolygonMode(GL_BACKfill_mode);
glFrontFace(GL_CCW);
glBegin(GL_TRIANGLE_FAN);//畫扇形
glVertex3d(00radius);
z?=?radius*sin(c80);
for(theta=-180;theta<=180;theta+=step){
???thetar?=?c*theta;
???x=radius*sin(thetar)*cos(c80);
???y=radius*cos(thetar)*cos(c80);
???if(color)
????glColor3f((rand()%101*1.0)/100(rand()%101*1.0)/100(rand()%101*1.0)/100);

???glVertex3d(xyz);
}
glEnd();
glBegin(GL_TRIANGLE_FAN);
glVertex3d(00-radius);
z=-radius*sin(c80);
for(theta=-180.0;theta<=180.0;theta+=step){
???thetar?=?c*theta;
???x=r

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????221230??2010-11-08?11:26??lab1\Debug\lab1.exe

?????文件?????266756??2010-11-08?11:26??lab1\Debug\lab1.ilk

?????文件?????329808??2010-11-08?11:26??lab1\Debug\lab1.pch

?????文件?????418816??2010-11-08?11:26??lab1\Debug\lab1.pdb

?????文件??????28714??2010-11-08?11:26??lab1\Debug\ss.obj

?????文件??????33792??2010-11-25?19:16??lab1\Debug\vc60.idb

?????文件??????45056??2010-11-08?11:26??lab1\Debug\vc60.pdb

?????文件???????4256??2010-11-08?11:26??lab1\lab1.dsp

?????文件????????533??2010-11-08?11:25??lab1\lab1.dsw

?????文件??????41984??2010-11-25?19:16??lab1\lab1.ncb

?????文件??????53760??2010-11-25?19:16??lab1\lab1.opt

?????文件???????1722??2010-11-08?11:26??lab1\lab1.plg

?????文件???????8490??2010-11-08?11:26??lab1\ss.c

?????目錄??????????0??2010-11-30?21:02??lab1\Debug

?????目錄??????????0??2010-11-30?21:02??lab1

-----------?---------??----------?-----??----

??????????????1454917????????????????????15


評論

共有 條評論