資源簡介
學校暑期課程科學可視化課程的ppt,需要的拿走。
2018/07/10 13:28 1 - Introduction
2018/07/10 13:29 2 - Transformation
2018/07/17 08:54 3 - OpenGL
2018/07/10 13:32 4 - Perspective Transformation
2018/07/10 13:32 5 - Color and Illumination
2018/07/10 13:32 6 - Visible Surface Determination
2018/07/10 13:32 7 - Clipping
2018/07/31 10:15 8 - VTK
2018/07/10 13:34 9 - Introduction to DVR and SF
代碼片段和文件信息
/*??CS?551?Assignment?1?skeleton?*/
/*??Brian?Clarke??*/
/*
keyboard?controls:
s/S: Positive/negative?shoulder?rotation
e/E: Positive/negative?elbow?rotation
O/C: Open/Close?the?hand?--?YOU?GET?TO?IMPLEMENT?THIS
x/X: Positive/negative?X-axis?shift?of?the?model
y/Y: Positive/negative?Y-axis?shift?of?the?model
UP/DOWN?ARROWS: (zoom)?Z-axis?shift?of?the?model
LEFT/RIGHT?ARROWS: Y-axis?rotations
PAGE?UP/DOWN: X-axis?rotations
ESC: exit
*/
#include
#include
#include
#include
#define?ESC?27
static?GLfloat?red[]={100}green[]={010};?/*?blue[]={001};?*/
static?int?shoulder=0elbow=0;
static?int?xrot=0yrot=0zrot=0;
static?GLfloat?xshift=-1.0yshift=0.0zoom=-3.0;
/*?some?basic?GL?initialization?*/
void?init()
{
glClearColor(0.00.00.00.0);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
}
/*?The?display?callback?*/
void?draw_stuff()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glPushMatrix();
glTranslatef(xshiftyshiftzoom);
glRotatef((GLfloat)xrot1.00.00.0);
glRotatef((GLfloat)yrot0.01.00.0);
glRotatef((GLfloat)zrot0.00.01.0);
glColor3fv(red);
glPushMatrix();
glTranslatef(-1.00.00.0);
glRotatef((GLfloat)shoulder0.00.01.0);
glTranslatef(1.00.00.0);
glPushMatrix();
glScalef(2.00.41.0);
glutSolidCube(1.0);
glPopMatrix();
glColor3fv(green);
glTranslatef(1.00.00.0);
glRotatef((GLfloat)elbow0.00.01.0);
glTranslatef(1.00.00.0);
glPushMatrix();
glScalef(2.00.41.0);
glutSolidCube(1.0);
glPopMatrix();
/*?Put?the?“hand“?code?here...*/
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
}
/*?the?window-reshape?callback?*/
void?reshape(int?w?int?h)
{
glViewport(00(GLsizei)w(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(65.0(GLfloat)w/(GLfloat)h1.020.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.00.0-5.0);
}
/*?The?basic?keyboard?controls?callback?for?glutKeyboardFunc()?*/
void?kb(unsigned?char?key?int?x?int?y)
{
switch(key)
{
case?‘s‘:
shoulder=(shoulder+5)%360;
glutPostRedisplay();
break;
case?‘S‘:
shoulder=(shoulder-5)%360;
glutPostRedisplay();
break;
case?‘e‘:
elbow=(elbow+5)%360;
glutPostRedisplay();
break;
case?‘E‘:
elbow=(elbow-5)%360;
glutPostRedisplay();
break;
case?‘C‘:
/*?close?the?“hand“?*/
break;
case?‘O‘:
/*?open?the?“hand“?*/
break;
case?‘x‘:
xshift+=.25;
glutPostRedisplay();
break;
case?‘X‘:
xshift-=.25;
glutPostRedisplay();
break;
case?‘y‘:
yshift+=.25;
glutPostRedisplay();
break;
case?‘Y‘:
yshift-=.25;
glutPostRedisplay();
break;
case?‘r‘:
case?‘R‘:
xrot=yrot=zrot=shoulder=elbow=0;
xshift=-1.0;
yshift=0.0;
zoom=-3.0;
glutPostRedisplay();
break;
case?‘z‘:
zrot=(zrot-1)%360;
glutPostRedisplay();
break;
case?‘Z‘:
zrot=(zrot+1)%360;
glutPostRed
- 上一篇:人物模型帶動畫
- 下一篇:大話設計模式(帶目錄完整版).zip
評論
共有 條評論