martes, 18 de septiembre de 2007

PREVIO 5

#include
#include
#include

void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}

void mouse(int button, int state, int x, int y)
{
if (state == GLUT_DOWN)
{
if ((glutGetWindow() == ventana1) && button == GLUT_LEFT_BUTTON)
{
xzoom = 255 - x;
yzoom = y - 255;
printf("%d, %d \n",x, y);
glutInitWindowSize (500, 500);
glutInitWindowPosition (700, 50);
ventana2 = glutCreateWindow ("Coordenadas especificas");
glutDisplayFunc(display_coordenadas);
glutReshapeFunc(reshape_coordenadas);
glutSetWindow(ventana2);
glutIdleFunc(NULL);
glutKeyboardFunc(keyboard);
glutMouseFunc(mouse);
}
else if ((glutGetWindow() == ventana2) && (button == GLUT_RIGHT_BUTTON)){
glutIdleFunc(NULL);
glutDestroyWindow(ventana2);
}
}
if (state == GLUT_UP)
{
if ((glutGetWindow() == ventana1) && button == GLUT_RIGHT_BUTTON)
{
printf("%d, %d \n",x, y);
glutInitWindowSize (800, 800);
glutInitWindowPosition (450, 0);
ventana3 = glutCreateWindow ("vENTANA3");
glutReshapeFunc(reshape_fractal);
glutSetWindow(ventana3);
glutKeyboardFunc(keyboard);
glutMouseFunc(mouse);
}
else if ((glutGetWindow() == ventana3) && (button == GLUT_RIGHT_BUTTON)){
glutIdleFunc(NULL);
glutDestroyWindow(ventana3);
//glutSetWindow(win1);
}
}
}

int main(int argc, char** argv)
{
//codigo para la primer ventana que despliega el fractal
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (700, 700);
glutInitWindowPosition (25, 50);
ventana1=glutCreateWindow ("Fractal Triangulo de Sierpenski Gasket");
glutSetWindow(ventana1);
init ();
glutDisplayFunc(
mouse);
glutReshapeFunc(reshape_
mouse);
glutIdleFunc(NULL);
glutKeyboardFunc(keyboard);
glutMouseFunc(mouse);
glutMainLoop();
return 0;
}

No hay comentarios: