xiluoc un pc pour les unirs .... | ,
On commence la programmation opengl, Tous le monde fait ca sous visual C++.
Mais j ai vraiment pas envie de rebooter pour ca.
Opengl est bien installer, du moins pour leus jeux ca tourne bien.
que dois-ja faire pour faire tourner ce code ?
Code :
- /*
- * hello2.c
- * This is a simple, introductory OpenGL program.
- * A white filled square on a black background is displayed.
- * This program is in a sense the shortest one which
- * produces the same effect as hello.c (from "red book" ).
- *
- * Scott McCallum February 2003
- */
- #include <GL/glut.h>
- void display(void)
- {
- /* clear entire screen window to background colour (black) */
- glClear(GL_COLOR_BUFFER_BIT);
- /* in standard square (with corners at (-1,-1) and (1,1) )
- * draw white filled square with corners at
- * (-0.5, -0.5) and (0.5, 0.5)
- */
- glRectf(-0.5, -0.5, 0.5, 0.5);
- /* flush buffer */
- glFlush();
- }
- /*
- * Declare initial window size and position.
- * Open window with "hello" in its title bar.
- * Register callback function to display graphics.
- * Enter main loop and wait for termination.
- */
- int main(int argc, char** argv)
- {
- glutInit(&argc, argv);
- glutInitWindowSize(250, 250);
- glutInitWindowPosition(100, 100);
- glutCreateWindow ("hello" );
- glutDisplayFunc(display);
- glutMainLoop();
- return 0;
- }
|
j ai essayer apt-get install glutd3
puis
Code :
- gcc -o h hello2.c -lGL -lGLU
|
mais ca donne rien
Code :
- /tmp/cc4lal1v.o(.text+0x5f): In function `main':
- : undefined reference to `glutInit'
- /tmp/cc4lal1v.o(.text+0x73): In function `main':
- : undefined reference to `glutInitWindowSize'
- /tmp/cc4lal1v.o(.text+0x87): In function `main':
- : undefined reference to `glutInitWindowPosition'
- /tmp/cc4lal1v.o(.text+0x93): In function `main':
- : undefined reference to `glutCreateWindow'
- /tmp/cc4lal1v.o(.text+0x9f): In function `main':
- : undefined reference to `glutDisplayFunc'
- /tmp/cc4lal1v.o(.text+0xa4): In function `main':
- : undefined reference to `glutMainLoop'
- collect2: ld returned 1 exit status
- zsh: exit 1 gcc -o h hello2.c -lGL -lGLU
|
|