菜鸟求助:关于cpp文件的问题
我首先用 3d max 做了一个 3ds 文件: 一个最简单的正方体。
然后用 Deep Exploration 导出了cpp 文件:
文件如下:
////////////////////////////////////////////////
#include <windows.h>
#include <GL\gl.h>
#include <GL\glu.h>
// 16 Verticies
// 24 Triangles
static GLint face_indicies[24][3] = {
// Object #-1
{2,1,0 }, {3,0,1 }, {6,5,4 }, {7,4,5 }, {3,6,0 }, {4,0,6 }, {1,5,3 },
{6,3,5 }, {2,7,1 }, {5,1,7 }, {0,4,2 }, {7,2,4 }
// Object #-1
, {10,9,8 }, {11,8,9 }, {14,13,12 }, {15,12,13 }, {11,14,8 },
{12,8,14 }, {9,13,11 }, {14,11,13 }, {10,15,9 }, {13,9,15 },
{8,12,10 }, {15,10,12 }
};
static GLfloat vertices [16][3] = {
{-0.277778f,-0.277778f,-0.5f},{0.277778f,0.277778f,-0.5f},{-0.277778f,0.277778f,-0.5f},
{0.277778f,-0.277778f,-0.5f},{-0.277778f,-0.277778f,0.0555556f},{0.277778f,0.277778f,0.0555556f},
{0.277778f,-0.277778f,0.0555556f},{-0.277778f,0.277778f,0.0555556f},{-0.5f,-0.5f,-0.5f},
{0.5f,0.5f,-0.5f},{-0.5f,0.5f,-0.5f},{0.5f,-0.5f,-0.5f},
{-0.5f,-0.5f,0.5f},{0.5f,0.5f,0.5f},{0.5f,-0.5f,0.5f},
{-0.5f,0.5f,0.5f}
};
GLint Gen3DObjectList()
{
int i;
int j;
GLint lid=glGenLists(1);
glNewList(lid, GL_COMPILE);
glBegin (GL_TRIANGLES);
for(i=0;i<sizeof(face_indicies)/sizeof(face_indicies[0]);i++)
{
for(j=0;j<3;j++)
{
int vi=face_indicies[j];
glVertex3f (vertices[vi][0],vertices[vi][1],vertices[vi][2]);
}
}
glEnd ();
glEndList();
return lid;
};
我要怎样才能把模型读出呀。大虾们给个例程吧.......................
3x3x3x3x3x3x3x33x3x3x3x33
|