###### 0.5 Degree

~~~~游走在0和1的间隙~~~~~

###### OpenGL Study 3

Lesson04

bool DrawGLScene(GLvoid)
{

//clear the screen and the depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

//reset the current modelview matrix
glLoadIdentity();

//move left 1.5 units,deep 6.0 units from current position

//move the model from (0,0,0) to (-1.5,0.0,-6.0),it can also be implemented by move the view point
glTranslatef(-1.5f,0.0f,-6.0f);

//rotate around the y axis
glRotatef(rtri,0.0f,1.0f,0.0f);

//draw a triangle,with smooth coloring
glBegin(GL_TRIANGLES);
glColor3f(
1.0f,0.0f,0.0f);
glVertex3f(
0.0f,1.0f,0.0f);
glColor3f(
0.0f,1.0f,0.0f);
glVertex3f(
-1.0f,-1.0f,0.0f);
glColor3f(
0.0f,0.0f,1.0f);
glVertex3f(
1.0f,-1.0f,0.0f);
glEnd();

//reset the current modleview matrix
glLoadIdentity();

//move from (0.0,0.0,0.0) to (1.5,0.0,-6.0)
glTranslatef(1.5f,0.0f,-6.0f);

//rotate around the x axis
glRotatef(rquad,1.0f,0.0f,0.0f);

//draw a quad,the vertex is represented in the model coordinate

//with flat coloring
glColor3f(0.5f,0.5f,1.0f);
glBegin(GL_QUADS);
glVertex3f(
-1.0f,1.0f,0.0f);
glVertex3f(
-1.0f,-1.0f,0.0f);
glVertex3f(
1.0f,-1.0f,0.0f);
glVertex3f(
1.0f,1.0f,0.0f);
glEnd();

rtri
+=0.2f;
rquad
-=0.15f;

return true;
}

Lesson05

bool DrawGLScene(GLvoid)
{

//clear the screen and the depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

//reset the current modelview matrix
glLoadIdentity();

//move left 1.5 units,deep 6.0 units from current position

//move the model from (0,0,0) to (-1.5,0.0,-6.0),it can also be implemented by move the view point
glTranslatef(-1.5f,0.0f,-6.0f);

//rotate around the y axis
glRotatef(rtri,0.0f,1.0f,0.0f);

//draw a diamond made of 4 triangles,with smooth coloring
glBegin(GL_TRIANGLES);

//front
glColor3f(1.0f,0.0f,0.0f);//red
glVertex3f(0.0f,1.0f,0.0f);
glColor3f(
0.0f,1.0f,0.0f);//green
glVertex3f(-1.0f,-1.0f,1.0f);
glColor3f(
0.0f,0.0f,1.0f);//blue
glVertex3f(1.0f,-1.0f,1.0f);

//right
glColor3f(1.0f,0.0f,0.0f);//red
glVertex3f(0.0f,1.0f,0.0f);
glColor3f(
0.0f,0.0f,1.0f);//blue
glVertex3f(1.0f,-1.0f,1.0f);
glColor3f(
0.5f,0.5f,0.0f);//rg
glVertex3f(1.0f,-1.0f,-1.0f);

//back
glColor3f(1.0f,0.0f,0.0f);//red
glVertex3f(0.0f,1.0f,0.0f);
glColor3f(
0.5f,0.5f,0.0f);//rg
glVertex3f(1.0f,-1.0f,-1.0f);
glColor3f(
0.5f,0.0f,0.5f);//rb
glVertex3f(-1.0f,-1.0f,-1.0f);

//back
glColor3f(1.0f,0.0f,0.0f);//red
glVertex3f(0.0f,1.0f,0.0f);
glColor3f(
0.5f,0.0f,0.5f);//rb
glVertex3f(-1.0f,-1.0f,-1.0f);
glColor3f(
0.0f,1.0f,0.0f);//green
glVertex3f(-1.0f,-1.0f,1.0f);

glEnd();

//reset the current modleview matrix
glLoadIdentity();

//move from (0.0,0.0,0.0) to (1.5,0.0,-6.0)
glTranslatef(1.5f,0.0f,-6.0f);

//rotate around the x axis
glRotatef(rquad,1.0f,0.0f,0.0f);

//draw a cubic made of 6 quads,the vertex is represented in the model coordinate

//with flat coloring
glBegin(GL_QUADS);

//top,y=1
glColor3f(1.0f,0.0f,0.0f);
glVertex3f(
-1.0f,1.0f,1.0f);
glVertex3f(
1.0f,1.0f,1.0f);
glVertex3f(
1.0f,1.0f,-1.0f);
glVertex3f(
-1.0f,1.0f,-1.0f);

//bottom,y=-1
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(
-1.0f,-1.0f,1.0f);
glVertex3f(
-1.0f,-1.0f,-1.0f);
glVertex3f(
1.0f,-1.0f,-1.0f);
glVertex3f(
1.0f,-1.0f,1.0f);

//front,z=1
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(
-1.0f,-1.0f,1.0f);
glVertex3f(
1.0f,-1.0f,1.0f);
glVertex3f(
1.0f,1.0f,1.0f);
glVertex3f(
-1.0f,1.0f,1.0f);

//right,x=1
glColor3f(1.0f,1.0f,0.0f);
glVertex3f(
1.0f,-1.0f,1.0f);
glVertex3f(
1.0f,-1.0f,-1.0f);
glVertex3f(
1.0f,1.0f,-1.0f);
glVertex3f(
1.0f,1.0f,1.0f);

//back,z=-1
glColor3f(0.0f,1.0f,1.0f);
glVertex3f(
-1.0f,-1.0f,-1.0f);
glVertex3f(
-1.0f,1.0f,-1.0f);
glVertex3f(
1.0f,1.0f,-1.0f);
glVertex3f(
1.0f,-1.0f,-1.0f);

//left,x=-1
glColor3f(1.0f,0.0f,1.0f);
glVertex3f(
-1.0f,-1.0f,1.0f);
glVertex3f(
-1.0f,1.0f,1.0f);
glVertex3f(
-1.0f,1.0f,-1.0f);
glVertex3f(
-1.0f,-1.0f,-1.0f);

glEnd();

rtri
+=0.2f;
rquad
-=0.15f;

return true;
}

#### OpenGL

2016年12月24日 20:43

#### OpenGL学习之路（一）

2016-05-07 10:58:28

#### 西蒙iphone-OpenGL ES 教程-01

2016年01月06日 260KB 下载

#### Study OpenGL

2010-03-24 15:03:00

#### OpenGL Study

2017-06-11 14:16:09

#### 《计算机图形学(OpenGL版)第3版》

2012-08-13 15:08:45

#### opengl study

2012年11月04日 644KB 下载

#### OpenGL3环境搭建

2016-10-17 14:17:46

#### opengl 很好的三维地形

2008年12月30日 1.22MB 下载

#### opengl c++ 纹理隐射 旋转立方体 纹理贴图 其中还有3*3贴图 对初学者有帮助

2009年12月14日 3.83MB 下载

OpenGL Study 3