[ubuntu-it] OpenGL

Bruno Aleci brunoaleci a gmail.com
Ven 16 Giu 2006 09:27:14 UTC


2006/6/16, Walter Valenti <waltervalenti a yahoo.it>:
> Sto provando a cimentarmi con la programmazione OpenGL.
> Ho installato i vari pacchetti "dev":
>
> libglut3-dev,freeglut3-dev,libgl1-mesa-dev,libglu1-mesa-dev,mesa-common-dev.
>
> Ho iniziato con un piccolo esempio preso dalla documentazione stessa.
>
> #include <GL/gl.h>
> #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)
>          * OpenGL Programming Guide (Addison-Wesley Publishing Company)
>          *
> http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dyna...G/@Generic__BookTextView/622;cs=fullhtml;pt=532
> (10 of 16) [4/28/2000 9:44:16 PM]
>          * */
>         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 (background) 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; /* ISO C requires main to return int. */
> }
>
>
> Provando a compilarlo ho il seguente errore:
> /tmp/ccIutZkT.o: In function `display':esempio.c:(.text+0xe): undefined
> referenc e to `glClear'
> :esempio.c:(.text+0x2d): undefined reference to `glColor3f'
> :esempio.c:(.text+0x39): undefined reference to `glBegin'
> :esempio.c:(.text+0x58): undefined reference to `glVertex3f'
> :esempio.c:(.text+0x77): undefined reference to `glVertex3f'
> :esempio.c:(.text+0x96): undefined reference to `glVertex3f'
> :esempio.c:(.text+0xb5): undefined reference to `glVertex3f'
> :esempio.c:(.text+0xba): undefined reference to `glEnd'
> :esempio.c:(.text+0xbf): undefined reference to `glFlush'
> /tmp/ccIutZkT.o: In function `init':esempio.c:(.text+0xef): undefined reference
> to `glClearColor'
> :esempio.c:(.text+0xfb): undefined reference to `glMatrixMode'
> :esempio.c:(.text+0x100): undefined reference to `glLoadIdentity'
> :esempio.c:(.text+0x12c): undefined reference to `glOrtho'
> /tmp/ccIutZkT.o: In function `main':esempio.c:(.text+0x14e): undefined
> reference  to `glutInit'
> :esempio.c:(.text+0x15a): undefined reference to `glutInitDisplayMode'
> :esempio.c:(.text+0x16e): undefined reference to `glutInitWindowSize'
> :esempio.c:(.text+0x182): undefined reference to `glutInitWindowPosition'
> :esempio.c:(.text+0x18e): undefined reference to `glutCreateWindow'
> :esempio.c:(.text+0x19f): undefined reference to `glutDisplayFunc'
> :esempio.c:(.text+0x1a4): undefined reference to `glutMainLoop'
> collect2: ld returned 1 exit status
>
>
> Qualcuno sa aiutarmi ?
>
> Grazie
> Walter
>
> --
> Per favore non inviatemi allegati in formato MS Office.
> Utilizza alternativamente documenti in formato OpenDocument.
>
> Software is like sex, it is better when it is free
> --Linus B. Torvalds
>
> Chiacchiera con i tuoi amici in tempo reale!
>  http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com
>
> --
> ubuntu-it mailing list
> ubuntu-it a lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-it
>
come hai compilato?




Maggiori informazioni sulla lista ubuntu-it