• 大小: 4KB
    文件类型: .cpp
    金币: 2
    下载: 1 次
    发布日期: 2021-06-16
  • 语言: C/C++
  • 标签: opengl  小动物  

资源简介

用opengl绘制的一个简单的小熊猫,萌萌哒,很可爱,主要用到圆以及多边形

资源截图

代码片段和文件信息

#include 
#include
int ij;  
const int N=8000;  
float x[N]y[N];
#define PI 3.1416 
void mydisplay(){
glClear(GL_COLOR_BUFFER_BIT);
glBlendFunc(GL_SRC_ALPHAGL_ONE_MINUS_SRC_ALPHA);  
glEnable(GL_POINT_SMOOTH);       //点抗锯齿  
glEnable(GL_LINE_SMOOTH);        //线抗锯齿  
glEnable(GL_POLYGON_SMOOTH);     //多边形抗锯齿  

//耳朵
glColor3f(0.00.00.0);
glBegin(GL_TRIANGLE_FAN); 
for(i=0;i {  
x[i]=0.18*cos(2*i*PI/N)+0.48;  
y[i]=0.18*sin(2*i*PI/N)+0.13;  
glVertex2f(x[i]y[i]);  
}  
glEnd();

glColor3f(0.00.00.0);
glBegin(GL_TRIANGLE_FAN); 
for(i=0;i {  
x[i]=0.18*cos(2*i*PI/N)-0.48;  
y[i]=0.18*sin(2*i*PI/N)+0.13;  
glVertex2f(x[i]y[i]);  
}  
glEnd();

//头
glColor3f(1.01.01.0);//用线进行图形连接  
glBegin(GL_TRIANGLE_FAN); 


for(i=0;i {  
x[i]=0.6*cos(2*i*PI/N);  
y[i]=0.55*sin(2*i*PI/N)-0.25;  
glVertex2f(x[i]y[i]);  
}  
glEnd();  

//眼睛
glColor3f(0.00.00.0);
glBegin(GL_TRIANGLE_FAN); 
for(i=0;i {  
x[i]=0.14*cos(2*i*PI/N)+0.24;  
y[i]=0.13*sin(2*i*PI/N)-0.21;  
glVertex2f(x[i]y[i]);  
}  
glEnd();

glColor3f(1.01.01.0);
glBegin(GL_TRIANGLE_FAN); 
for(i=0;i {  
x[i]=0.04*cos(2*i*PI/N)+0.20;  
y[i]=0.05*sin(2*i*PI/N)-0.22;  
glVertex2f(x[i]y[i]);  
}  
glEnd();

glColor3f(0.00.00.0);
glBegin(GL_TRIANGLE_FAN);
for(i=0;i {  
x[i]=0.025*cos(2*i*PI/N)+0.195;  
y[i]=0.023*sin(2*i*PI/N)-0.22;  
glVertex2f(x[i]y[i]);  
}  
glEnd();

glColor3f(1.01.01.0);
glBegin(GL_TRIANGLE_FAN); 
for(i=0;i {  
x[i]=0.008*cos(2*i*PI/N)+0.190;  
y[i]=0.008*sin(2*i*PI/N)-0.22;  
glVertex2f(x[i]y[i]);  
}  
glEnd();

glColor3f(0.00.00.0);
glBegin(GL_TRIANGLE_FAN); 
for(i=0;i {  
x[i]=0.14*cos(2*i*PI/N)-0.24;  
y[i]=0.13*sin(2*i*PI/N)-0.21;  
glVertex2f(x[i]y[i]);  
}  
glEnd();

glColor3f(1.01.01.0);
glBegin(GL_TRIANGLE_FAN); 
for(i=0;i {  
x[i]=0.04*cos(2*i*PI/N)-0.20;  
y[i]=0.05*sin(2*i*PI/N)-0.22;  
glVertex2f(x[i]y[i]);  
}  
glEnd();


评论

共有 条评论