资源简介
OpenGL代码,画花瓶,可以填充,选择颜色,涉及OpenGL一些简单编程知识。

代码片段和文件信息
///////////////////////////////////////////////////
///////////////////////////////////////////////////
//
//fhwork is made by fh and his classmates
//2004.7.8
//
#include
#include
#include
#include
#include
//////////////////////////////////////////
#define Width_Normal 1
#define Width_Thicker 2
#define Width_Thickest 3
#define iColor_Red 4
#define iColor_Green 5
#define iColor_White 6
#define iColor_Yellow 7
#define iColor_Blue 8
#define iFillIN_No 9
#define iFillIN_Single 10
#define iFillIN_Transition 11
// Rotation amounts
static GLfloat xRot = 0.0f;
static GLfloat yRot = 0.0f;
int iWidth = Width_Normal;
int iColor = iColor_Green;
int iFillIN = iFillIN_No;
GLfloat i=0;
//bezier‘s points
GLint nNumPoints = 6;
GLfloat ctrlPoints_Right[6][3] = {{ 20.0f 70.0f 0.0f} // End Point
{ 15.0f 50.0f 0.0f} // Control Point
{ 5.0f 20.0f 0.0f} // Control Point
{ 70.0f 0.0f 0.0f} // Control Point
{ 40.0f -40.0f 0.0f} // Control Point
{ 30.0f -70.0f 0.0f }}; // End Point
GLfloat ctrlPoints_Left[6][3] = {{ -20.0f 70.0f 0.0f} // End Point
{ -15.0f 50.0f 0.0f} // Control Point
{ -5.0f 20.0f 0.0f} // Control Point
{ -70.0f 0.0f 0.0f} // Control Point
{ -40.0f -40.0f 0.0f} // Control Point
{ -30.0f -70.0f 0.0f }}; // End Point
// This function does any needed initialization on the rendering context.
void ProcessMenu(int value)
{
switch(value)
{
case 1:
iWidth = Width_Normal;
break;
case 2:
iWidth = Width_Thicker;//中
break;
case 3:
iWidth = Width_Thickest;//粗
break;
case 4:
iColor = iColor_Red;
break;
case 5:
iColor = iColor_Green;
break;
case 6:
iColor = iColor_White;
break;
case 7:
iColor = iColor_Yellow;
break;
case 8:
iColor = iColor_Blue;
break;
case 9:
iFillIN = iFillIN_No;
break;
case 10:
iFillIN = iFillIN_Single;
break;
case 11:
iFillIN = iFillIN_Transition;
break;
default:
break;
}
glutPostRedisplay();
}
// Called to draw scene
void RenderScene(void)
{
// Clear the window
glClear(GL_COLOR_BUFFER_BIT);
// Save matrix state and do the rotation
glPushMatrix();
glRotatef(xRot 1.0f 0.0f 0.0f);
glRotatef(yRot 0.0f 1.0f 0.0f);
// Set the line width 线宽
if(iWidth == Width_Normal)
glLineWidth(1.0f);
if(iWidth == Width_Thicker)
glLineWidth(3.0f);
if(iWidth == Width_Thickest)
glLineWidth(5.0f);
// Set drawing color 颜色
if(iColor == iColor_Red)
glColor3f(1.0f 0.0f 0.0f);
if(iColor == iColor_Green)
glColor3f(0.0f 1.0f 0.0f);
if(iColor == iColor_White)
glColor3f(1.0f 1.0f 1.0f);
if(iColor == iColor_Yellow)
glColor3f(1.0f 1.0f 0.0f);
if(iColor == iColor_Blue)
glColor3f(0.0f 0.0f 1.0f);
//填充
if(iFillIN == i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 27216 2004-07-17 15:04 OpenGL画花瓶,可以填充,选择颜色等\Debug\FHWork.obj
文件 172110 2007-01-25 18:32 OpenGL画花瓶,可以填充,选择颜色等\Debug\FH_Work.exe
文件 247728 2004-07-17 15:04 OpenGL画花瓶,可以填充,选择颜色等\Debug\FH_Work.ilk
文件 451584 2004-07-17 15:04 OpenGL画花瓶,可以填充,选择颜色等\Debug\FH_Work.pdb
文件 148480 2004-07-17 15:06 OpenGL画花瓶,可以填充,选择颜色等\Debug\vc60.idb
文件 77824 2004-07-17 15:04 OpenGL画花瓶,可以填充,选择颜色等\Debug\vc60.pdb
文件 8505 2004-07-13 11:43 OpenGL画花瓶,可以填充,选择颜色等\FHWork.cpp
文件 4334 2004-07-10 19:43 OpenGL画花瓶,可以填充,选择颜色等\FH_Work.dsp
文件 539 2004-07-10 19:43 OpenGL画花瓶,可以填充,选择颜色等\FH_Work.dsw
文件 50176 2009-02-13 13:55 OpenGL画花瓶,可以填充,选择颜色等\FH_Work.ncb
文件 1298 2004-07-17 15:04 OpenGL画花瓶,可以填充,选择颜色等\FH_Work.plg
文件 98304 2009-02-13 13:55 OpenGL画花瓶,可以填充,选择颜色等\FH_Work.opt
目录 0 2004-07-10 18:07 OpenGL画花瓶,可以填充,选择颜色等\Debug
目录 0 2004-11-14 15:13 OpenGL画花瓶,可以填充,选择颜色等
----------- --------- ---------- ----- ----
1288098 14
相关资源
- OpenGL参考手册
- Qt Creator opengl实现四元数鼠标控制轨迹
- OpenGL文档,api大全,可直接查询函数
- opengl轮廓字体源代码
- MFC读三维模型obj文件
- 利用OpenGL写毛笔字算法
- MFC中OpenGL面和体的绘制以及动画效果
- 基于OPENGL的光线跟踪源代码368758
- VC 实现三维旋转(源码)
- 自编用openGL实现3D分形树,分形山
- OpenGL球形贴图自旋程序
- OpenGL导入贴图的Texture类
- 计算机图形学(openGL)代码
- 用OpenGL开发的机械臂运动仿真程序(
- OpenGL-3D坦克模拟
- OPENGL实现世界上最小的3D游戏
- VS2012OpenGL配置所需要的全部libdllh文件
- 基于OpenGL的仿蝗虫机器人三维动态仿
- 图形学 - OpenGL实现3种三维茶壶显示源
- opengl程序-会跳舞的骷髅
- opengl实现三维网格光顺Laplacian算法
- opengl——爆炸
- OpenGL三维地形建模
- opengl游戏编程徐明亮版(含源码)
- 用OPENGL画的一个简单的直升飞机
- opengl完美天空盒
- 3D绘图程序设计:使用Direct3D 10/9和Ope
- OpenGL绘制可运动自行车源程序.zip
- OpenGL实现飘动效果
- opengl室内场景的绘制,包括碰撞检测
评论
共有 条评论