资源简介
一整套的经典OPENGL的案例,初学者和高手都使用的资源
代码片段和文件信息
/*
Source file to be used with
Cunningham Computer Graphics: Programming in OpenGL for Visual Communication Prentice-Hall 2007
Intended for class use only
*/
#include “../inc/glut.h“
#include
#include
#include
#define ANGLE 5.0
#define ORIGINAL // ORIGINAL shows the parts; undefining it shows only the view
typedef GLfloat point3[3];
static char ch; // the character from the keyboard that controls the rotation
GLfloat light_position[]={ 16.0 14.0 8.0 };
GLfloat light_color[]={ 1.0 1.0 1.0 1.0 };
GLfloat ambient_color[]={ 0.2 0.2 0.2 1.0 };
GLfloat gray_10[] = {1.0 1.0 1.0 1.0} // white
color_green[] = {0 1.0 0 1.0}
color_red[] = {1.0 0.0 0.0 1.0}
color_blue[] = {0 0 1.0 1.0}
gray_02[] = {0.2 0.2 0.2 1.0}
gray_00[] = {0.0 0.0 0.0 1.0};
GLfloat white[]={1.0 1.0 1.0 1.0} red[]={1.0 0.0 0.0 1.0}
green[]={0.0 1.0 0.0 1.0} blue[]={0.0 0.0 1.0 1.0}
yellow[]={1.0 1.0 0.0 1.0} cyan[]={0.0 1.0 1.0 1.0}
magenta[]={1.0 1.0 0.0 1.0} black[]={0.0 0.0 0.0 1.0};
GLfloat eye_x eye_y eye_z cov_x cov_y cov_z up_x up_y up_z; // data for “eye“ within view
GLfloat view_x view_y view_z;
GLfloat xAngle = 0. yAngle = 0. zAngle = 0.;
// function prototypes follow
void myinit( void );
void drawAxes(float);
void drawAxis(float char);
void model( void );
void scene(void);
void drawHouse(void);
void display( void );
void reshape( int int );
void keyboard(unsigned char int int );
void myinit(void)
{
glClearColor( .2 .2 .2 1. );
glShadeModel(GL_SMOOTH);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE 0);
glLightfv(GL_LIGHT0 GL_POSITION light_position );
glLightfv(GL_LIGHT0 GL_AMBIENT ambient_color );
glLightfv(GL_LIGHT0 GL_DIFFUSE light_color );
glEnable(GL_NORMALIZE);
glLineWidth(3.);
/* attributes */
glEnable(GL_DEPTH_TEST); // allow z-buffer display
view_x = 26.;
view_y = -4.;
view_z = 8.;
eye_x = 2.5;
eye_y = 2.5;
eye_z = 6.;
cov_x = 1.5;
cov_y = 1.5;
cov_z = 4.;
up_x = 0.;
up_y = 1.;
up_z = 0.;
}
void drawAxis(float scale char whichAxis)
{
// Axes are to be colored according to the axis selected
GLfloat coneHeight coneRad axisLength axisRad;
// granularity of cone
#define GRAN 10
// Set the sizes for the axes
coneHeight = scale*0.05;
coneRad = scale*0.03;
axisRad = scale*0.005;
axisLength = scale;
glEnable(GL_SMOOTH);
// Draw the standard axis in Z-orientation
switch(whichAxis) {
case ‘x‘:
glColor4fv(color_red);
glBegin(GL_QUAD_STRIP);
glVertex3f( axisRad axisRad axisLength );
glVertex3f( axisRad axisRad 0. );
glVertex3f(-axisRad axisRad axisLength );
glVertex3f(-axisRad axisRad 0. );
glVertex3f(-axisRad-axisRad axisLength );
glVertex3f(-axisRad-axisRad 0. );
glVertex3f( axisRad-axisRad axisLength );
glVe
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2223104 2010-07-11 14:38 CGApps2010-07-11\CGApps\CGApps.ncb
文件 27807744 2012-05-04 10:01 CGApps2010-07-11\CGApps\CGApps.sdf
文件 20287 2012-03-09 09:59 CGApps2010-07-11\CGApps\CGApps.sln
文件 20244 2010-07-11 14:18 CGApps2010-07-11\CGApps\CGApps.sln.old
..A..H. 82432 2012-05-04 10:01 CGApps2010-07-11\CGApps\CGApps.suo
..A..H. 71168 2010-07-11 14:38 CGApps2010-07-11\CGApps\CGApps.suo.old
文件 169984 1998-08-18 16:25 CGApps2010-07-11\CGApps\Dll\glut32.dll
文件 326656 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Debug\DrawHouse.exe
文件 1756160 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Debug\DrawHouse.pdb
文件 169984 1998-08-18 16:25 CGApps2010-07-11\CGApps\DrawHouse\Debug\glut32.dll
文件 12328 2010-05-14 09:04 CGApps2010-07-11\CGApps\DrawHouse\Demo.cpp
文件 4849 2010-03-11 22:34 CGApps2010-07-11\CGApps\DrawHouse\DrawHouse.vcproj
文件 1411 2010-07-11 14:38 CGApps2010-07-11\CGApps\DrawHouse\DrawHouse.vcproj.ZQY-ZJU.hare.user
文件 6751 2012-03-09 09:59 CGApps2010-07-11\CGApps\DrawHouse\DrawHouse.vcxproj
文件 940 2012-03-09 09:57 CGApps2010-07-11\CGApps\DrawHouse\DrawHouse.vcxproj.filters
文件 143 2012-03-09 09:57 CGApps2010-07-11\CGApps\DrawHouse\DrawHouse.vcxproj.user
文件 10064 2010-06-23 17:51 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\BuildLog.htm
文件 1014 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\cl.command.1.tlog
文件 2152 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\CL.read.1.tlog
文件 490 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\CL.write.1.tlog
文件 39114 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\Demo.obj
文件 381 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\DrawHouse.exe.intermediate.manifest
文件 93 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\DrawHouse.lastbuildstate
文件 3568 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\DrawHouse.log
文件 1812 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\li
文件 2926 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\li
文件 734 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\li
文件 716 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\mt.command.1.tlog
文件 842 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\mt.read.1.tlog
文件 396 2012-03-09 11:36 CGApps2010-07-11\CGApps\DrawHouse\Obj\Debug\mt.write.1.tlog
............此处省略1312个文件信息
相关资源
- opengl包含16个鼠标控制点的Bezier曲面
- qt下opengl的三维视角转换算法
- OpenGL鱼眼镜头特效的视频播放器 基于
- opengl实现bezier曲面的纹理贴图、鼠标
- assimp.dll
- OpenGL SDK
- OpenGL读取点云文件并绘制
- 计算机图形学大作业
- OpenCV与OpenGL实现增强现实
- 3d opengl 飞行射击游戏源码和论文
- 20个可读的obj模型文件
- opengl实现模型读取以及光照,移动等
- Opengl实现旗帜飘扬效果
- OpenGL星星公转自转
- OpenGL显示三维点云图像
- opengl绘制太阳、地球、月球
- Qt通过控件控制立方体旋转
- OpenGL编程指南 第九版英文版 OpenGL P
- 三维游戏设计师宝典(经典!)——学
- OpenGL课程设计
- OpenGL飘动的雏菊画布
- OpenGL-篮球场.rar
- opengl显示兔子程序
- learnopengl-cn-2018年5月更新.pdf
- OpenGL超级宝典完整源码(第五版)
- OpenGL游戏程序设计+源码
- opengl编程指南第七版
- 基于OpenGL实现的各种粒子特效
- 3D模型obj文件导入渲染光照贴图
- OpenGL配置库与教程实现一个.
评论
共有 条评论