|
|
#include<windows.h>
#include<GL/glut.h>
void init(void)
{
glClearColor(0,0,0,0);
glShadeModel(GL_FLAT);
}
void display(void)
{
GLdouble eqn[4]={0,1,0,0};
GLdouble eqn1[4]={1,0,0,0};
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,1);
glPushMatrix();
glTranslatef(0,0,-5);
glClipPlane(GL_CLIP_PLANE0,eqn);
glEnable(GL_CLIP_PLANE0);
glClipPlane(GL_CLIP_PLANE1,eqn1);
glEnable(GL_CLIP_PLANE1);
glRotatef(90,1,1,1);
glutWireSphere(1.0,20,16);
glPopMatrix();
glFlush();
}
void reshape(int w , int y)
{
glViewport(0,0,(GLsizei)w,(GLsizei)y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60,(GLfloat)w/(GLfloat)y,1,20);
glMatrixMode(GL_MODELVIEW);
}
int main(int argc, char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow(argv[0]);
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}
编译没问题,但联接出现错误,求各位帮忙
ex02.obj : error LNK2005: "void __cdecl init(void)" (?init@@YAXXZ) already defined in ex01.obj
ex02.obj : error LNK2005: "void __cdecl display(void)" (?display@@YAXXZ) already defined in ex01.obj
ex02.obj : error LNK2005: "void __cdecl reshape(int,int)" (?reshape@@YAXHH@Z) already defined in ex01.obj
ex02.obj : error LNK2005: _main already defined in ex01.obj
Debug/ex01.exe : fatal error LNK1169: one or more multiply defined symbols found
|
|