Главная страница


ru.linux

 
 - RU.LINUX ---------------------------------------------------------------------
 From : Grigory Temchenko                    2:5062/6.50    15 Jun 2004  13:25:26
 To : All
 Subject : glut
 -------------------------------------------------------------------------------- 
 
 
 у кого-нибудь это компилится?
 
 #include <stdio.h>
 #include <GL/glut.h>
 
 int WindW, WindH;
 int i;
 int alpha;
 
 void Reshape(int width, int height) // Reshape function
 {
   glViewport(0, 0, width, height);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   gluOrtho2D(-1, 1, -1, 1);
   glMatrixMode(GL_MODELVIEW);
 
   WindW = width;
   WindH = height;
 }
 
 void Draw(void) // Window redraw function
 {
   glClear(GL_COLOR_BUFFER_BIT);
 
   glLineWidth(3);
   glColor3f(0.0f, 0.6f, 0.9f);
 
   glPushMatrix();
   glRotatef(alpha, 0.0f, 0.0f, 1.0f);
   alpha += 4;
   if (alpha > 359) alpha = 0;
   glBegin(GL_LINES);
     glVertex2f(-0.5f, 0.5f);
     glVertex2f(0.5f, -0.5f);
   glEnd();
   glPopMatrix();
 
   glFlush();
   glutSwapBuffers();
 }
 
 void Visibility(int state) // Visibility function
 {
   if (state == GLUT_NOT_VISIBLE) printf("Window not visible!\n");
   if (state == GLUT_VISIBLE) printf("Window visible!\n");
 }
 
 void timf(int value) // Timer function
 {
   glutPostRedisplay();  // Redraw windows
   glutTimerFunc(40, timf, 0); // Setup next timer
 }
 
 int main(int argc, char *argv[])
 {
   WindW = 400;
   WindH = 300;
   alpha = 0;
 
   glutInit(&argc, argv);
   glutInitWindowSize(WindW, WindH);
   glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
   (void)glutCreateWindow("Romka Demo");
 
   glutReshapeFunc(Reshape); // Set up reshape function
   glutDisplayFunc(Draw);    // Set up redisplay function
   glutTimerFunc(40, timf, 0); // Set up timer for 40ms, about 25 fps
   glutVisibilityFunc(Visibility); // Set up visibility funtion
   glClearColor(0, 0, 0, 0);
 
   glutMainLoop();
 
   return 0;
 }
 У меня пишет:
 
 [grigory@localhost prog]$ gcc glut_test_1.cpp
 /tmp/ccUwlJSp.o(.text+0x11): In function `Reshape(int, int)':
 : undefined reference to `glViewport'
 /tmp/ccUwlJSp.o(.text+0x21): In function `Reshape(int, int)':
 : undefined reference to `glMatrixMode'
 /tmp/ccUwlJSp.o(.text+0x29): In function `Reshape(int, int)':
 : undefined reference to `glLoadIdentity'
 /tmp/ccUwlJSp.o(.text+0x4a): In function `Reshape(int, int)':
 : undefined reference to `gluOrtho2D'
 /tmp/ccUwlJSp.o(.text+0x5a): In function `Reshape(int, int)':
 : undefined reference to `glMatrixMode'
 /tmp/ccUwlJSp.o(.text+0x83): In function `Draw()':
 : undefined reference to `glClear'
 /tmp/ccUwlJSp.o(.text+0x93): In function `Draw()':
 : undefined reference to `glLineWidth'
 /tmp/ccUwlJSp.o(.text+0xaa): In function `Draw()':
 : undefined reference to `glColor3f'
 /tmp/ccUwlJSp.o(.text+0xb2): In function `Draw()':
 : undefined reference to `glPushMatrix'
 /tmp/ccUwlJSp.o(.text+0xcd): In function `Draw()':
 : undefined reference to `glRotatef'
 /tmp/ccUwlJSp.o(.text+0xf7): In function `Draw()':
 : undefined reference to `glBegin'
 /tmp/ccUwlJSp.o(.text+0x10c): In function `Draw()':
 : undefined reference to `glVertex2f'
 /tmp/ccUwlJSp.o(.text+0x121): In function `Draw()':
 : undefined reference to `glVertex2f'
 /tmp/ccUwlJSp.o(.text+0x129): In function `Draw()':
 : undefined reference to `glEnd'
 /tmp/ccUwlJSp.o(.text+0x12e): In function `Draw()':
 : undefined reference to `glPopMatrix'
 /tmp/ccUwlJSp.o(.text+0x133): In function `Draw()':
 : undefined reference to `glFlush'
 /tmp/ccUwlJSp.o(.text+0x138): In function `Draw()':
 : undefined reference to `glutSwapBuffers'
 /tmp/ccUwlJSp.o(.text+0x179): In function `timf(int)':
 : undefined reference to `glutPostRedisplay'
 /tmp/ccUwlJSp.o(.text+0x18a): In function `timf(int)':
 : undefined reference to `glutTimerFunc'
 /tmp/ccUwlJSp.o(.text+0x1cd): In function `main':
 : undefined reference to `glutInit'
 /tmp/ccUwlJSp.o(.text+0x1e4): In function `main':
 : undefined reference to `glutInitWindowSize'
 /tmp/ccUwlJSp.o(.text+0x1f1): In function `main':
 : undefined reference to `glutInitDisplayMode'
 /tmp/ccUwlJSp.o(.text+0x201): In function `main':
 : undefined reference to `glutCreateWindow'
 /tmp/ccUwlJSp.o(.text+0x211): In function `main':
 : undefined reference to `glutReshapeFunc'
 /tmp/ccUwlJSp.o(.text+0x221): In function `main':
 : undefined reference to `glutDisplayFunc'
 /tmp/ccUwlJSp.o(.text+0x235): In function `main':
 : undefined reference to `glutTimerFunc'
 /tmp/ccUwlJSp.o(.text+0x245): In function `main':
 : undefined reference to `glutVisibilityFunc'
 /tmp/ccUwlJSp.o(.text+0x255): In function `main':
 : undefined reference to `glClearColor'
 /tmp/ccUwlJSp.o(.text+0x25d): In function `main':
 : undefined reference to `glutMainLoop'
 /tmp/ccUwlJSp.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
 collect2: ld returned 1 exit status
 [grigory@localhost prog]$
 
 Куда копать?
 
 Следи за собой, будь осторожен!
 
 --- Вы думаете это бредит малярия?
  * Origin: Чайф - Внеплановый концерт (2:5062/6.50)
 
 

Вернуться к списку тем, сортированных по: возрастание даты  уменьшение даты  тема  автор 

 Тема:    Автор:    Дата:  
 glut   Grigory Temchenko   15 Jun 2004 13:25:26 
 glut   Vitaly Mayatskih   15 Jun 2004 18:27:04 
 Re: glut   Alexander Drozdov   16 Jun 2004 00:40:48 
 Re^2: glut   Grigory Temchenko   16 Jun 2004 10:18:58 
 Re: Re^2: glut   Mikhail Gusarov   16 Jun 2004 19:56:28 
 Re: glut   Andrey Kiselev   17 Jun 2004 11:10:43 
 Re^2: glut   Alexander Drozdov   17 Jun 2004 09:40:24 
 Re: glut   Mikhail Gusarov   16 Jun 2004 05:56:58 
 Re: glut   Sergey Krinitsin   17 Jun 2004 13:02:57 
Архивное /ru.linux/275940cec130.html, оценка 2 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional