Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/01/2013, 15:19
reethok
 
Fecha de Ingreso: abril-2011
Mensajes: 224
Antigüedad: 13 años
Puntos: 8
Problema con GLUT

Estoy haciendo un tutorial (muy sencillo) y tengo un "pequeño" problema:

Código C:
Ver original
  1. #include <GL/glut.h>
  2.  
  3. void render();
  4.  
  5. int main(int argc, char** argv)
  6. {
  7.     glutInit(&argc, argv);
  8.     glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
  9.     glutInitWindowPosition(100, 100);
  10.     glutInitWindowSize(640, 480);
  11.     glutCreateWindow("Nombre de la Ventana");
  12.  
  13.     glutDisplayFunc(render);
  14.  
  15.     glutMainLoop();
  16. }
  17.  
  18. void render()
  19. {
  20.     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  21.  
  22.     glutSwapBuffers();
  23.         glColor3f(1, 0, 0);
  24.         glVertex2f(-0.5, -0.5);
  25.         glColor3f(0, 1, 0);
  26.         glVertex2f(0.5, -0.5);
  27.         glColor3f(0, 0, 1);
  28.         glVertex2f(0.0, 0.5);
  29.     glBegin(GL_TRIANGLES);
  30.  
  31.     glEnd();
  32. }

Este programa debería mostrarme una ventana con un triángulo en el centro, de muchos colores, pero sólo me muestra una ventana con el fondo negro, ¿por qué? D:, el código es exactamente igual (salvo el string) que el tutorial en video, y ahí sí sale correctamente.