OPENGL 经典案例 整套
一整套的经典OPENGL的案例,初学者和高手都使用的资源
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2223104 2010-07-11 14:38 CGApps2010-07-11CGAppsCGApps.ncb
文件 27807744 2012-05-04 10:01 CGApps2010-07-11CGAppsCGApps.sdf
文件 20287 2012-03-09 09:59 CGApps2010-07-11CGAppsCGApps.sln
文件 20244 2010-07-11 14:18 CGApps2010-07-11CGAppsCGApps.sln.old
..A..H. 82432 2012-05-04 10:01 CGApps2010-07-11CGAppsCGApps.suo
..A..H. 71168 2010-07-11 14:38 CGApps2010-07-11CGAppsCGApps.suo.old
文件 169984 1998-08-18 16:25 CGApps2010-07-11CGAppsDllglut32.dll
文件 326656 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseDebugDrawHouse.exe
文件 1756160 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseDebugDrawHouse.pdb
文件 169984 1998-08-18 16:25 CGApps2010-07-11CGAppsDrawHouseDebugglut32.dll
文件 12328 2010-05-14 09:04 CGApps2010-07-11CGAppsDrawHouseDemo.cpp
文件 4849 2010-03-11 22:34 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcproj
文件 1411 2010-07-11 14:38 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcproj.ZQY-ZJU.hare.user
文件 6751 2012-03-09 09:59 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcxproj
文件 940 2012-03-09 09:57 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcxproj.filters
文件 143 2012-03-09 09:57 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcxproj.user
文件 10064 2010-06-23 17:51 CGApps2010-07-11CGAppsDrawHouseObjDebugBuildLog.htm
文件 1014 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugcl.command.1.tlog
文件 2152 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugCL.read.1.tlog
文件 490 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugCL.write.1.tlog
文件 39114 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugDemo.obj
文件 381 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugDrawHouse.exe.intermediate.manifest
文件 93 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugDrawHouse.lastbuildstate
文件 3568 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugDrawHouse.log
文件 1812 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebuglink.command.1.tlog
文件 2926 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebuglink.read.1.tlog
文件 734 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebuglink.write.1.tlog
文件 716 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugmt.command.1.tlog
文件 842 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugmt.read.1.tlog
文件 396 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugmt.write.1.tlog
............此处省略1312个文件信息
/*
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-11CGAppsCGApps.ncb
文件 27807744 2012-05-04 10:01 CGApps2010-07-11CGAppsCGApps.sdf
文件 20287 2012-03-09 09:59 CGApps2010-07-11CGAppsCGApps.sln
文件 20244 2010-07-11 14:18 CGApps2010-07-11CGAppsCGApps.sln.old
..A..H. 82432 2012-05-04 10:01 CGApps2010-07-11CGAppsCGApps.suo
..A..H. 71168 2010-07-11 14:38 CGApps2010-07-11CGAppsCGApps.suo.old
文件 169984 1998-08-18 16:25 CGApps2010-07-11CGAppsDllglut32.dll
文件 326656 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseDebugDrawHouse.exe
文件 1756160 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseDebugDrawHouse.pdb
文件 169984 1998-08-18 16:25 CGApps2010-07-11CGAppsDrawHouseDebugglut32.dll
文件 12328 2010-05-14 09:04 CGApps2010-07-11CGAppsDrawHouseDemo.cpp
文件 4849 2010-03-11 22:34 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcproj
文件 1411 2010-07-11 14:38 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcproj.ZQY-ZJU.hare.user
文件 6751 2012-03-09 09:59 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcxproj
文件 940 2012-03-09 09:57 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcxproj.filters
文件 143 2012-03-09 09:57 CGApps2010-07-11CGAppsDrawHouseDrawHouse.vcxproj.user
文件 10064 2010-06-23 17:51 CGApps2010-07-11CGAppsDrawHouseObjDebugBuildLog.htm
文件 1014 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugcl.command.1.tlog
文件 2152 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugCL.read.1.tlog
文件 490 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugCL.write.1.tlog
文件 39114 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugDemo.obj
文件 381 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugDrawHouse.exe.intermediate.manifest
文件 93 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugDrawHouse.lastbuildstate
文件 3568 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugDrawHouse.log
文件 1812 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugli
文件 2926 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugli
文件 734 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugli
文件 716 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugmt.command.1.tlog
文件 842 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugmt.read.1.tlog
文件 396 2012-03-09 11:36 CGApps2010-07-11CGAppsDrawHouseObjDebugmt.write.1.tlog
............此处省略1312个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)