Professional Documents
Culture Documents
TEXTURAS2D
TEXTURAS2D
TEXTURAS2D
h>
#include <stdlib.h>
#include <stdio.h>
#include<math.h>
{{0,64,0},{0,128,0},{0,192,0},{0,255,0}}, //Verdes
{{0,0,64},{0,0,128},{0,0,192},{0,0,255}}, //Azules
{{64,64,0},{128,128,0},{192,192,0},{255,255,0}} //Amarillos
};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//
glMatrixMode(GL_MODELVIEW);
glViewport(0,0, width,height);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
void PintaArcoIris(){
glClearColor(0,0,0,0);
//
glEnable(GL_TEXTURE_2D);
//
//
glTexImage2D(GL_TEXTURE_2D,0,3,4,4,0,GL_RGB, GL_UNSIGNED_BYTE,Colores);
//
//
//
/*
glBegin(GL_QUADS);
glEnd();
*/
glBegin(GL_QUADS);
glEnd();
glutSwapBuffers();
glFlush();
/*
glBegin(GL_TRIANGLES);
glTexCoord2d(0.0,1.0);
glVertex3f(-0.5,-0.5, 0.5);
glTexCoord2d(1.0,1.0);
glVertex3f(0.5,-0.5,0.5);
glTexCoord2d(0.5,0.0);
glVertex3f(0.0,0.5,0.5);
glEnd();
glutSwapBuffers();
glFlush();
*/
glutInit(&argc,argv);
glutInitWindowPosition(100,100);
glutInitWindowSize(400,400);
glutCreateWindow("Textura 2D");
glutDisplayFunc(PintaArcoIris);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;