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

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


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


Desconectado Desconectado

Mensajes: 638


Ver Perfil
glut
« en: 14 Septiembre 2010, 06:57 am »

replantee todo  ahora solo quiero que cuando haga click en la  ventana  me vuelva a mostra otro grafico ......................................
Código
  1. #include<windows.h>
  2. #include <GL/glut.h>
  3. #define ancho 320
  4. #define altura 240
  5. #define profundidad 500
  6. void DibujaCuadrado();
  7. void ejesxy();
  8. void TecladoMovimiento(int tecla, int x, int y);
  9. int posx=0, posy=0;
  10. int main(int argc, char** argv) {
  11. glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
  12. glutInitWindowPosition(100, 0);
  13. glutInitWindowSize(500, 500);
  14. glutCreateWindow("GRAFICADOR ");
  15. glOrtho(-20, 300, -40, 200, -profundidad, profundidad);
  16. glClearColor(1, 1, 1, 0);
  17. glutDisplayFunc(DibujaCuadrado);
  18. glutMainLoop();
  19. return 0;
  20. }
  21. void DibujaCuadrado() {
  22. glClear(GL_COLOR_BUFFER_BIT);
  23. ejesxy();
  24. glPushMatrix();
  25. glTranslatef(posx, posy,0);
  26. glBegin( GL_LINE_STRIP );
  27.  for(int i=0;i<300;i++)
  28.  {
  29.      int x=rand()%100;
  30.  
  31.  
  32.   //draw polyline
  33.    glVertex2i( i, x );
  34.    glVertex2i( i, 0 );
  35.  
  36.  }
  37. glEnd();
  38. glPopMatrix();
  39. glutSwapBuffers();
  40. }
  41. void ejesxy() {
  42. glColor3f(1.0, 0.0, 0.0);
  43. glBegin(GL_LINES);
  44. glVertex2f(-20, 0);
  45. glVertex2f(300, 0);
  46. glVertex2f(0, 200);
  47. glVertex2f(0, -40);
  48. glEnd();
  49. }
  50.  
  51.  


« Última modificación: 15 Septiembre 2010, 06:58 am por mapers » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Problema Dev c++ (glut) « 1 2 »
Programación C/C++
alexis33de 12 9,453 Último mensaje 8 Diciembre 2010, 23:31 pm
por alexis33de
ingreso de texto en GLUT
Programación C/C++
neo_from_cs_matrix 1 5,068 Último mensaje 29 Octubre 2018, 23:38 pm
por El Master Rata Pro
Problema OpenGL y glut.h (Libreria)
Programación C/C++
totolia 1 5,524 Último mensaje 13 Mayo 2012, 20:50 pm
por totolia
cómo se hacen las rejas 3D en glut y opengl « 1 2 3 »
Programación C/C++
ahigor 20 7,989 Último mensaje 18 Marzo 2017, 15:58 pm
por ahigor
Disparo parabolico en c++ con la libreria GLUT
Programación C/C++
SaulH 1 3,960 Último mensaje 28 Marzo 2023, 10:18 am
por Lieutenant McFarley
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines