#include <GL/glut.h>
GLint winWidth = 1600, winHeight = 1280;
GLfloat x0 = 0.0, y0 = 300.0, z0 = 150;
GLfloat xref = 0.0, yref = 0.0, zref = 50.0;
GLfloat Vx = 0.0, Vy = 0.0, Vz = 1.0;
GLfloat xwMin = -50.0, ywMin = -40.0, xwMax = 50.0, ywMax = 40.0;
GLfloat dnear = 50.0, dfar = 600.0;
void init(void)
{
glClearColor(1.0, 1.0, 1.0, 0.0);
glMatrixMode(GL_MODELVIEW);
//gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
gluLookAt(x0, y0, z0, xref, yref, zref, Vx, Vy, Vz);//第一组eyex, eyey,eyez 相机在世界坐标的位置
//第二组centerx, centery, centerz 相机镜头对准的物体在世界坐标的位置
//第三组upx, upy, upz 相机向上的方向在世界坐标中的方向
glMatrixMode(GL_PROJECTION);
glFrustum(xwMin, xwMax, ywMin, ywMax, dnear, dfar);
}
void displayFcn(void)
{
int i, j;
float point[138][3] =
{
{
150,25,0},{
95,25,0},{
95,-25,0},{
150,-25,0},{
125,14,140},{
102,14,140},{
102,-14,140},{
125,-14,140}
,{
126,17,145},{
100,17,145},{
100,-17,145},{
126,-17,145},{
126,17,150},{
100,17,150},{
100,-17,150},{
126,-17,150}
,{
135,30,160},{
80,30,160},{
80,-30,160},{
135,-30,160},{
135,30,165},{
80,30,165},{
80,-30,165},{
135,-30,165}
,{
-95,25,0},{
-150,25,0},{
-150,-25,0},{
-95,-25,0},{
-102,14,140},{
-125,14,140},{
-125,-14,140},{
-102,-14,140}
,{
-100,17,145},{
-126,17,145},{
-126,-17,145},{
-100,-17,145},{
-100,17,150},{
-126,17,150},{
-126,-17,150},{
-100,-17,150}
,{
-80,30,160},{
-135,30,160},{
-135,-30,160},{
-80,-30,160},{
-80,30,165},{
-135,30,165},{
-135,-30,165},{
-80,-30,165}
,{
110,30,165},{
-110,30,165},{
-110,-30,165},{
110,-30,165},{
110,30,185},{
-110,30,185},{
-110,-30,185},{
110,-30,185}
,{
115,20,170},{
-115,20,170},{
-115,-20,170},{
115,-20,170},{
125,20,180},{
125,-20,180},{
-125,20,180},{
-125,-20,180}
,{
125,20,190},{
-125,20,190},{
-125,-20,190
【计算机图形学】实验报告7绘制空间物体3D线框图
最新推荐文章于 2021-12-20 23:54:29 发布