Hola aquí les traigo las iniciales en 2D
====código=====
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include <stdlib.h>
static void display(void)
{
glClearColor(1,1,1,0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
typedef GLfloat point2[2];
point2 vertice[54] = {
{100.0,100.0}, //v0
{200.0,100.0}, //v1
{320.0,400.0}, //v2
{250.0,400.0}, //v3
{200.0,300.0}, //v4
{150.0,400.0}, //v5
{80.0,400.0}, //v6
{150.0,200.0}, //v7
{100.0,380.0}, //v8
{180.0,320.0}, //v9
{40.0,350.0}, //v10
{100.0,200.0}, //v11
{50.0,130.0}, //v12
//vertices para la letra s
{400.0,100.0}, //v13
{700.0,100.0}, //v14
{700.0,260.0}, //v15
{500.0,260.0}, //v16
{500.0,320.0}, //v17
{700.0,320.0}, //v18
{700.0,370.0}, //v19
{400.0,370.0}, //v20
{400.0,210.0}, //v21
{600.0,210.0}, //v22
{600.0,150.0}, //v23
{400.0,150.0}, //v24
//FONDO
{500.0,400.0}, //v25
{750.0,400.0}, //v26
{750.0,350.0}, //v27
{580.0,280.0}, //v28
{750.0,280.0}, //v29
{750.0,150.0}, //v30
{580.0,320.0}, //v31
{480.0,180.0}, //v32
{600.0,180.0}, //v33
//Letra Q
{880.0,370.0}, //v34
{1400.0,370.0}, //35
{880.0,330.0}, //v36
{1400.0,330.0}, //v37
{1100.0,330}, //v38
{1250.0,330}, //v39 --
{1100.0,180}, //v40
{1250.0,100}, //v41--
{880.0,100}, //42
{880.0,180}, //v43
//FONDO
{780.0,390.0}, //V44
{1300.0,390.0}, //V45
{780.0,350.0}, //V46
{780.0,200.0}, //V47
{1000.0,330}, //V48 ---
{1000.0,200}, //V49
{780.0,150}, //V50
};
glColor3f(0.0,0.0,1.0);
gluOrtho2D(0.0, 1800.0, 0.0, 500.0);
//Letra S
glColor3f(1.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2fv(vertice[13]);
glVertex2fv(vertice[14]);
glVertex2fv(vertice[14]);
glVertex2fv(vertice[15]);
glVertex2fv(vertice[15]);
glVertex2fv(vertice[16]);
glVertex2fv(vertice[16]);
glVertex2fv(vertice[17]);
glVertex2fv(vertice[17]);
glVertex2fv(vertice[18]);
glVertex2fv(vertice[18]);
glVertex2fv(vertice[19]);
glVertex2fv(vertice[19]);
glVertex2fv(vertice[20]);
glVertex2fv(vertice[20]);
glVertex2fv(vertice[21]);
glVertex2fv(vertice[21]);
glVertex2fv(vertice[22]);
glVertex2fv(vertice[22]);
glVertex2fv(vertice[23]);
glVertex2fv(vertice[23]);
glVertex2fv(vertice[24]);
glVertex2fv(vertice[24]);
glVertex2fv(vertice[13]);
//fondo
glVertex2fv(vertice[20]);
glVertex2fv(vertice[25]);
glVertex2fv(vertice[25]);
glVertex2fv(vertice[26]);
glVertex2fv(vertice[26]);
glVertex2fv(vertice[27]);
glVertex2fv(vertice[26]);
glVertex2fv(vertice[19]);
glVertex2fv(vertice[27]);
glVertex2fv(vertice[18]);
glVertex2fv(vertice[27]);
glVertex2fv(vertice[18]);
glVertex2fv(vertice[28]);
glVertex2fv(vertice[29]);
glVertex2fv(vertice[28]);
glVertex2fv(vertice[31]);
glVertex2fv(vertice[28]);
glVertex2fv(vertice[16]);
glVertex2fv(vertice[15]);
glVertex2fv(vertice[29]);
glVertex2fv(vertice[29]);
glVertex2fv(vertice[30]);
glVertex2fv(vertice[30]);
glVertex2fv(vertice[14]);
glVertex2fv(vertice[24]);
glVertex2fv(vertice[32]);
glVertex2fv(vertice[32]);
glVertex2fv(vertice[33]);
glEnd();
//Letra J
glLineStipple(1,0x00FF);
glEnable(GL_LINE_STIPPLE); //esto es la linea entrecortada
glColor3f(0.0,0.0,1.0);
glBegin(GL_LINES);
glVertex2fv(vertice[34]);
glVertex2fv(vertice[35]);
glVertex2fv(vertice[35]);
glVertex2fv(vertice[37]);
glVertex2fv(vertice[37]);
glVertex2fv(vertice[39]);
glVertex2fv(vertice[34]);
glVertex2fv(vertice[36]);
glVertex2fv(vertice[36]);
glVertex2fv(vertice[38]); //
glVertex2fv(vertice[38]);
glVertex2fv(vertice[40]);
glVertex2fv(vertice[39]);
glVertex2fv(vertice[41]);
glVertex2fv(vertice[41]);
glVertex2fv(vertice[42]); //
glVertex2fv(vertice[42]);
glVertex2fv(vertice[43]);
glVertex2fv(vertice[43]);
glVertex2fv(vertice[40]);
//FONDO
glVertex2fv(vertice[35]);
glVertex2fv(vertice[45]);
glVertex2fv(vertice[45]);
glVertex2fv(vertice[44]);
glVertex2fv(vertice[44]);
glVertex2fv(vertice[46]);
glVertex2fv(vertice[44]);
glVertex2fv(vertice[34]);
glVertex2fv(vertice[46]);
glVertex2fv(vertice[36]);
glVertex2fv(vertice[48]);
glVertex2fv(vertice[49]);
glVertex2fv(vertice[49]);
glVertex2fv(vertice[40]);
glVertex2fv(vertice[49]);
glVertex2fv(vertice[47]);
glVertex2fv(vertice[47]);
glVertex2fv(vertice[43]);
glVertex2fv(vertice[47]);
glVertex2fv(vertice[50]);
glVertex2fv(vertice[50]);
glVertex2fv(vertice[42]);
glEnd();
glutSwapBuffers();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(512,512);
glutInitWindowPosition(20,20);
glutCreateWindow("Letras 2D");
glutDisplayFunc(display);
glutMainLoop();
return EXIT_SUCCESS;
}
0 comentarios:
Publicar un comentario