求助: freebsd6.2 搭建 openGL 开发环境
如题.
#cd /usr/ports/graphics/freeglut/
#make install clean
#cd /usr/ports/graphics/libglut/
#make install clean
分别去找了这两个源.
http://heanet.dl.sourceforge.net/sourceforge/freeglut/freeglut-2.4.0.tar.gz
http://heanet.dl.sourceforge.net/sourceforge/mesa3d/MesaDemos-6.4.2.tar.gz
- #ls /usr/local/include/GL/
- freeglut.h freeglut_ext.h freeglut_std.h glut.h
复制代码
//库文件有了。
- # gcc -lglut t.c -o t
- t.c:1:21: GL/glut.h: No such file or directory
- t.c: In function `display':
- t.c:5: error: `GL_COLOR_BUFFER_BIT' undeclared (first use in this function)
- t.c:5: error: (Each undeclared identifier is reported only once
- t.c:5: error: for each function it appears in.)
- t.c:10: error: `GL_POLYGON' undeclared (first use in this function)
- t.c: In function `init':
- t.c:26: error: `GL_PROJECTION' undeclared (first use in this function)
- t.c: In function `main':
- t.c:40: error: `GLUT_SINGLE' undeclared (first use in this function)
- t.c:40: error: `GLUT_RGB' undeclared (first use in this function)
复制代码
编译出错
t.c 找的一段测试代码:
- #include <GL/glut.h>
- void display(void)
- {
- /* clear all pixels */
- glClear (GL_COLOR_BUFFER_BIT);
- /* draw white polygon (rectangle) with corners at
- * (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)
- */
- glColor3f (1.0, 1.0, 1.0);
- glBegin(GL_POLYGON);
- glVertex3f (0.25, 0.25, 0.0);
- glVertex3f (0.75, 0.25, 0.0);
- glVertex3f (0.75, 0.75, 0.0);
- glVertex3f (0.25, 0.75, 0.0);
- glEnd();
- /* don't wait!
- * start processing buffered OpenGL routines
- */
- glFlush ();
- }
- void init (void)
- {
- /* select clearing color */
- glClearColor (0.0, 0.0, 0.0, 0.0);
- /* initialize viewing values */
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
- }
- /*
- * Declare initial window size, position, and display mode
- * (single buffer and RGBA). Open window with "hello"
- * in its title bar. Call initialization routines.
- * Register callback function to display graphics.
- * Enter main loop and process events.
- */
- int main(int argc, char** argv)
- {
- glutInit(&argc, argv);
- glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
- glutInitWindowSize (250, 250);
- glutInitWindowPosition (100, 100);
- glutCreateWindow ("hello");
- init ();
- glutDisplayFunc(display);
- glutMainLoop();
- return 0; /* ANSI C requires main to return int. */
- }
复制代码
这个是什么原因呢??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ln -s /usr/local/lib/libglut.so /usr/lib/libglut.so
ln -s /usr/local/include/GL /usr/include/GL
后,错误如下
复制代码