Created
October 7, 2015 23:26
-
-
Save ricardofiorani/4a905b27c36e9ecf4adb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
#include <iostream> | |
#include <GL/glut.h> | |
using namespace std; | |
void desenha(){ | |
glClearColor(0.0,0.0,0.0,0.0); | |
glClear(GL_COLOR_BUFFER_BIT); | |
glMatrixMode(GL_PROJECTION); | |
glLoadIdentity(); | |
glOrtho(0,256,0,256,-1,1); | |
glColor3f(1.0,0.0,0.0); | |
//Desenhando a borda | |
glBegin(GL_POLYGON); | |
glVertex2i(91,157); | |
glVertex2i(135,81); | |
glVertex2i(102,81); | |
glVertex2i(102,16); | |
glVertex2i(80,16); | |
glVertex2i(79,83); | |
glVertex2i(49,83); | |
glEnd(); | |
//Desenhando o triangulo | |
glColor3f(0.0,1.0,0.0); | |
glBegin(GL_POLYGON); | |
glVertex2i(90,156); | |
glVertex2i(134,82); | |
glVertex2i(101,82); | |
glVertex2i(101,18); | |
glVertex2i(78,18); | |
glVertex2i(78,82); | |
glVertex2i(48,82); | |
glEnd(); | |
glFlush(); | |
} | |
int main(int argc, char *argv[]) | |
{ | |
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); | |
glutCreateWindow("Desenhe pontos"); | |
glutDisplayFunc(desenha); | |
glutMainLoop(); | |
system("PAUSE"); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment