关于c++的连接错误

smsgreenlife 2010-02-24 03:41:03
我用deep exploration转换的.cpp源文件,连接时出错,哪位高手给看看!
/*
This file was produced by Deep Exploration Plugin: CPP Export filter.

Copyright (C) 1999-2008 Right Hemisphere
Mail support@righthemisphere.com for support.
Visit http://www.righthemisphere.com/dexp.htm for updates.
*/
#include <windows.h>
//#include <GL\gl.h>
//#include <GL\glu.h>
#include <glut.h>

struct sample_MATERIAL
{
GLfloat ambient[3];
GLfloat diffuse[3];
GLfloat specular[3];
GLfloat emission[3];
GLfloat alpha;
GLfloat phExp;
int texture;
};

static sample_MATERIAL materials [1] = {
{{0.117647f,0.117647f,0.117647f}, {0.796078f,0.823529f,0.937255f}, {0.150588f,0.150588f,0.150588f}, {0.0f,0.0f,0.0f}, 1.0f,8.0f,-1} //mat0
};

// 13 Verticies
// 0 Texture Coordinates
// 6 Normals
// 12 Triangles

static BYTE face_indicies[12][9] = {
// cube
{0,1,2 ,0,0,0 ,0,0,0}, {1,3,2 ,0,0,0 ,0,0,0}, {4,5,6 ,1,1,1 ,0,0,0},
{5,7,6 ,1,1,1 ,0,0,0}, {8,4,9 ,2,2,2 ,0,0,0}, {4,6,9 ,2,2,2 ,0,0,0},
{10,8,11 ,3,3,3 ,0,0,0}, {8,9,11 ,3,3,3 ,0,0,0}, {4,8,0 ,4,4,4 ,0,0,0},
{8,10,0 ,4,4,4 ,0,0,0}, {9,6,11 ,5,5,5 ,0,0,0}, {6,12,11 ,5,5,5 ,0,0,0}
};
static GLfloat vertices [13][3] = {
{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},{-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}
};
static GLfloat normals [6][3] = {
{8.163e-018f,-1.0f,0.0f},{1.0f,1.15648e-016f,0.0f},{0.0f,1.0f,0.0f},
{-1.0f,0.0f,0.0f},{0.0f,0.0f,1.0f},{0.0f,0.0f,-1.0f}
};
GLfloat textures[1][2]={{0.0f,0.0f}};
/*Material indicies*/
/*{material index,face count}*/
static int material_ref [1][2] = {
{0,12}
};
void MyMaterial(GLenum mode, GLfloat * f, GLfloat alpha)
{
GLfloat d[4];
d[0] = f[0];
d[1] = f[1];
d[2] = f[2];
d[3] = alpha;
glMaterialfv(GL_FRONT_AND_BACK, mode, d);
}

/*
* SelectMaterial uses OpenGL commands to define facet colors.
*
* Returns:
* Nothing
*/

void SelectMaterial(int i)
{
//
// Define the reflective properties of the 3D Object faces.
//
glEnd();
GLfloat alpha = materials[i].alpha;
MyMaterial(GL_AMBIENT, materials[i].ambient, alpha);
MyMaterial(GL_DIFFUSE, materials[i].diffuse, alpha);
MyMaterial(GL_SPECULAR, materials[i].specular, alpha);
MyMaterial(GL_EMISSION, materials[i].emission, alpha);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, materials[i].phExp);
glBegin(GL_TRIANGLES);

};

GLint Gen3DObjectList()
{
int i;
int j;

GLint lid=glGenLists(1);
int mcount=0;
int mindex=0;
glNewList(lid, GL_COMPILE);

glBegin (GL_TRIANGLES);
for(i=0;i<sizeof(face_indicies)/sizeof(face_indicies[0]);i++)
{
if (!mcount)
{
SelectMaterial(material_ref[mindex][0]);
mcount = material_ref[mindex][1];
mindex ++;
}
mcount --;
for(j=0;j<3;j++)
{
int vi=face_indicies[i][j];
int ni=face_indicies[i][j+3];//Normal index
int ti=face_indicies[i][j+6];//Texture index
glNormal3f (normals[ni][0],normals[ni][1],normals[ni][2]);
glTexCoord2f(textures[ti][0],textures[ti][1]);
glVertex3f (vertices[vi][0],vertices[vi][1],vertices[vi][2]);
}
}
glEnd ();

glEndList();
return lid;
};
...全文
139 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
InfidelX 2010-02-24
  • 打赏
  • 举报
回复
兄弟断章取义很郁闷的事情~没头没尾的怎么找错误啊~
Qlaiaqu 2010-02-24
  • 打赏
  • 举报
回复
出错了总有个错吧,把错贴出来吗

64,642

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧