elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  opengl rotacion
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: opengl rotacion  (Leído 4,020 veces)
mapers


Desconectado Desconectado

Mensajes: 638


Ver Perfil
opengl rotacion
« en: 28 Octubre 2010, 04:13 am »

quisiera que me ayudaran a poder rotar por si solo el cuadrado que e dibujado estoy tratando pero no veo resultados sigue estatico y no se mueve
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. #include <GL/glut.h>
  10. #define ancho 320
  11. #define altura 240
  12. #define profundidad 500
  13. void DibujaCuadrado();
  14. void EjesXY();
  15. void Teclado(unsigned char tecla, int x, int y);
  16. int angulo=0;
  17. int main(int argc, char** argv) {
  18. glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
  19. glutInitWindowPosition(100, 0);
  20. glutInitWindowSize(ancho, altura);
  21. glutCreateWindow("Rotación de un Cuadrado en 2D");
  22. glOrtho(-(ancho/2), (ancho/2), -(altura/2), (altura/2), -profundidad, profundidad);
  23. glClearColor(1, 1, 1, 0);
  24. glutDisplayFunc(DibujaCuadrado);
  25. glutKeyboardFunc(Teclado);
  26. glutMainLoop();
  27. return 0;
  28. }
  29. void DibujaCuadrado() {
  30. glClear(GL_COLOR_BUFFER_BIT);
  31. EjesXY();
  32. glPushMatrix();
  33. glRotatef(angulo, 0, 0, 1);
  34. glBegin(GL_QUADS);
  35. glColor3f(1, 0, 0);glVertex2i(50,50);
  36. glColor3f(1, 1, 0);glVertex2i(-50, 50);
  37. glColor3f(1, 0, 0);glVertex2i(-50, -50);
  38. glColor3f(1, 1, 0);glVertex2i(50, -50);
  39. glEnd();
  40. glPopMatrix();
  41. glutSwapBuffers();
  42. }
  43. void EjesXY() {
  44. glColor3f(1.0, 0.0, 1.0);
  45. glBegin(GL_LINES);
  46. glVertex2i(-ancho/2, 0);
  47. glVertex2i(ancho/2, 0);
  48. glVertex2i(0, altura/2);
  49. glVertex2i(0, -altura/2);
  50. glEnd();
  51. }
  52. void Teclado(unsigned char tecla, int x, int y) {
  53. while(angulo=!0)
  54. {
  55. angulo++;
  56.  
  57. }
  58. glutPostRedisplay();
  59. }
  60.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Rotación automatica de fondos de pantalla (WindowsXP)
Software
vincent13m 3 3,718 Último mensaje 29 Enero 2011, 01:58 am
por SuperDraco
AffineTransform rotación y movimiento
Java
gelpack 1 2,426 Último mensaje 24 Mayo 2013, 04:07 am
por crozz2
Slide de rotacion
Desarrollo Web
kakashi20 1 1,482 Último mensaje 13 Noviembre 2014, 23:40 pm
por engel lex
c++ Opengl problema no puedo hacer un correcto movimiento de cámara con rotación
Programación C/C++
zargonori 2 2,912 Último mensaje 13 Noviembre 2015, 22:26 pm
por 6666
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines