Академический Документы
Профессиональный Документы
Культура Документы
TALLER #4
Manejo de elementos gráficos en entornos digitales.
Realizado por:
Requena, Tomas 20-70-3735
Solanilla, Fabio 8-954-2298
Uribe, Daniel 20-14-3774
Vasquez, Andres 20-70-4081
Anel Vasquez
PANAMÁ, 2019
INTRODUCCIÓN
En este trabajo estamos plasmando los conocimientos que hemos adquirido durante
el curso de ‘Herramientas de computación gráfica’, curso en el cual hemos tenido la
oportunidad utilizar la herramienta OpenGl para crear figuras primitivas con las cuales
hemos compuesto gráficos más complejos, siendo en este caso una pista de
aterrizaje - Tomas Requena
La principal idea de este taller es mostrar el potencial que tienen este tipo de
herramientas, que con el uso de figuras geometricas se pueden crear dibujos
completos - Daniel Uribe
OpenGL es una herramienta espectacular para el dibujo digital, en esta nueva tarea
realizaremos una pista de aterrizaje basandonos en una vista superior de un avion -
Fabio Solanilla
A traves del uso de las diferentes figuras basicas con las cuales podemos dibujar en
OpenGL - GLUT, trataremos de representar una foto de una pista de aterrizaje en la
cual se mostrara la vista de forma superior - Andres Vasquez
Lograr que una combinación de figuras basicas como triangules, rombos, rectangulos
y poligonos de diferentes lados puedan redibujar una foto es un reto interesante, a
continuación con OpenGL y GLUT trataremos de lograr el objetivo del taller - Anel
Vasquez
CODIGO
#include <iostream>
#include <GL/glut.h>
void configMatrix() {
glClearColor(getRGB(128), getRGB(229), getRGB(222), 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(-100, 100, -100, 100); /* left, right, bottom, top */
glEnable(GL_DEPTH_TEST);
}
void drawPlane() {
glBegin(GL_QUADS);
glColor3f(0, 0, getRGB(135));
glVertex3f(-20.0, 0.0, 0.0f);
glVertex3f(-10.0, 50.0, 0.0f);
glVertex3f(10.0, 50.0, 1.0f);
glVertex3f(20.0, 0.0, 1.0f);
glEnd();
glFlush();
glBegin(GL_QUADS);
glColor3f(getRGB(135), 0, 0);
glVertex3f(-50.0, 20.0, 0.0f);
glVertex3f(-50.0, -20.0, 0.0.f);
glVertex3f(50.0, -20.0, 1.0f);
glVertex3f(50.0, 20.0, 1.0f);
glEnd();
glFlush();
glBegin(GL_POLYGON);
glColor3f(getRGB(135), 0, 0);
glVertex3f(-50.0, 20.0, 1.0f);
glVertex3f(-65.0, 20.0, 0.0f);
glVertex3f(-85.0, -2.0, 0.0f);
glVertex3f(-85.0, -20.0, 0.0f);
glVertex3f(-50.0, -20.0, 1.0f);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f(getRGB(255), getRGB(240), getRGB(230));
glBegin(GL_QUADS);
glColor3f(0, 0, getRGB(135/));
glVertex3f(-20.0, -10.0, 0.0f);
glVertex3f(-10.0, -50.0, 0.0f);
glVertex3f(10.0, -50.0, 1.0f);
glVertex3f(20.0, -10.0, 1.0f);
glEnd();
glFlush();
glBegin(GL_POLYGON);
glColor3f(getRGB(135), 0, 0);
glVertex3f(50.0, -20.0, 1.0f);
glVertex3f(80.0, -20.0, 0.0f);
glVertex3f(80.0, 50.0, 0.0f);
glVertex3f(65.0, 50.0, 0.0f);
glVertex3f(50.0, 20.0, 1.0f);
glEnd();
glFlush();
glBegin(GL_QUADS);
glColor3f(0, 0, getRGB(135));
glVertex3f(60.0, -12.5, 0.0f);
glVertex3f(70.0, -35.0, 0.0f);
glVertex3f(80.0, -40.0, 1.0f);
glVertex3f(80.0, -12.5, 1.0f);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f(getRGB(255), getRGB(240), getRGB(230));
glBegin(GL_TRIANGLES);
glColor3f(getRGB(255), getRGB(240), getRGB(230));
glBegin(GL_TRIANGLES);
glColor3f(getRGB(255), getRGB(240), getRGB(230));
glBegin(GL_TRIANGLES);
glColor3f(getRGB(255), getRGB(240), getRGB(230));
glBegin(GL_TRIANGLES);
glColor3f(getRGB(255), getRGB(240), getRGB(230));
void makeLand() {
glBegin(GL_POLYGON);
glColor3f(getRGB(44), getRGB(50), getRGB(19));
glVertex3f(-100.0, 10.0, 0.0f);
glColor3f(getRGB(44), getRGB(50), getRGB(19));
glEnd();
glFlush();
}
void makeMountains() {
//Big Mountains
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(-100.0, 10.0f, 0.0f);
glColor3f(getRGB(219), getRGB(219), getRGB(219));
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(-20.0, 10.0f, 0.0f);
glColor3f(getRGB(219), getRGB(219), getRGB(219));
glVertex3f(20.0, 80.0f, 0.0f);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(60.0, 10.0, 0.0f);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(60.0, 10.0f, 0.0f);
glColor3f(getRGB(219), getRGB(219), getRGB(219));
glVertex3f(100.0, 80.0f, 0.0f);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(140.0, 10.0, 0.0f);
glEnd();
glFlush();
//Normal Mountains
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(-110.0, 10.0f, 0.0f);
glColor3f(getRGB(189), getRGB(191), getRGB(114));
glVertex3f(-85.0f, 50.0f, 0.0f);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(-60.0f, 10.0, 0.0f);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(-60.0, 10.0f, 0.0f);
glColor3f(getRGB(189), getRGB(191), getRGB(114));
glVertex3f(-35.0f, 50.0f, 0.0f);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(-10.0f, 10.0, 0.0f);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(40.0, 10.0f, 0.0f);
glColor3f(getRGB(189), getRGB(191), getRGB(114));
glVertex3f(65.0f, 50.0f, 0.0f);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(90.0f, 10.0, 0.0f);
glEnd();
glFlush();
//Small Mountains
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(-100.0, 10.0f, 0.0f);
glColor3f(getRGB(22), getRGB(130), getRGB(40));
glVertex3f(-65.0f, 30.0f, 0.0f);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(-20.0f, 10.0, 0.0f);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glBegin(GL_TRIANGLES);
glColor3f(getRGB(71), getRGB(40), getRGB(7));
glVertex3f(30.0, 10.0f, 0.0f);
glColor3f(getRGB(22), getRGB(130), getRGB(40));
void draw(void) {
glClear(GL_COLOR_BUFFER_BIT);
drawPlane();
}
Con este taller hemos tenido la oportunidad de llevar a cabo una imagen de una pista
de aterrizaje en 2D, el cual se ha tenido el desafíoio de lograr que por medio de figuras
geométricas se le dé forma al dibujo.
Podemos concluir que OpenGl es una herramienta poderosa que tiene mucho
potencial, pero Glut la librería que se utilizó al ser bastante antigua se encuentran
algunos inconvenientes y tiene un uso bastante más rudimentario que otras
herramientas actuales.