Foro de elhacker.net

Programación => Programación C/C++ => Mensaje iniciado por: mapers en 7 Junio 2010, 05:25 am



Título: Color de Relleno
Publicado por: mapers en 7 Junio 2010, 05:25 am
Buenas gente del foro quisiera que me ayudaran a darle un relleno a mi figura yo le mando los parametros respectivos a cada vertice pero solo me  da el color de las lineas mas no el relleno a ver si me dan una manita aki les dejo mi codigo.....



Código
  1. #include<windows.h>
  2. #ifdef __APPLE__
  3. #include <GLUT/glut.h>
  4. #else
  5. #include <GL/glut.h>
  6. #endif
  7.  
  8. #include <stdlib.h>
  9.  
  10. void display(void) {
  11. glClearColor(0.0,0.0,0.0,0.0);
  12. glClear(GL_COLOR_BUFFER_BIT);
  13.  
  14. glOrtho(-5.0,5.0,-5.0,5.0,-5.0,5.0);
  15.  
  16.  
  17.  
  18.  
  19. glBegin(GL_LINE_LOOP);
  20.  
  21. glColor3f(1.0f,0.0f,0.0f);
  22. glVertex2f(4.0,0.0);
  23. glVertex2f(2.0,1.0);
  24. glVertex2f(2.0,2.0);
  25. glVertex2f(1.0,2.0);
  26. glVertex2f(0.0,4.0);
  27. glVertex2f(-1.0,2.0);
  28. glVertex2f(-2.0,2.0);
  29. glVertex2f(-2.0,1.0);
  30. glVertex2f(-4.0,0.0);
  31. glVertex2f(-2.0,-1.0);
  32. glVertex2f(-2.0,-2.0);
  33. glVertex2f(-1.0,-2.0);
  34. glVertex2f(0.0,-4.0);
  35. glVertex2f(1.0,-2.0);
  36. glVertex2f(2.0,-2.0);
  37. glVertex2f(2.0,-1.0);
  38. glVertex2f(4.0,0.0);
  39. glEnd();
  40. glFlush();
  41. glutSwapBuffers();
  42. }
  43. int main() {
  44. glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
  45. glutInitWindowSize(400, 400);
  46. glutInitWindowPosition(200, 200);
  47. glutCreateWindow("Estilos de Lineas");
  48. glutDisplayFunc(display);
  49. glutMainLoop();
  50. }
  51.  
  52.  
  53.