Entradas

Mostrando entradas de agosto, 2017

Práctiica 2: Ejercicio 3

Imagen
#include<stdlib.h> #include<math.h> #include<stdio.h> #include<windows.h> #include <GL/glut.h> GLsizei wh = 600, ww = 800,wx,wy, wx1=800, wy1=600; char* image; int count=0; int sub_menu; int draw; int i,j,k; float a[100][2], b[100][2]; int m, n; int pol; int flag=0, flag1; int fill=0; float textx,texty, textz=0.0; float a1=0, a2=0, a3=0, b1=0, b2=0, b3=0; int size=1; int save=0; float posx, posy; void *currentfont; FILE *fptr; char fname[20]; int s=0; int wel=0; void drawstring(float x,float y,float z,char *string) { char *c; glRasterPos3f(x,y,z); for(c=string;*c!='\0';c++) { glutBitmapCharacter(currentfont,*c); } } void setFont(void *font) { currentfont=font; } void drawpoint(int x, int y) { y=wh-y; if(x>wh/10+1 && wh/10<y && y<wh-31) { glPointSize(size); glBegin(GL_POINTS); glVertex2f(x, y); glEnd(); glFlush(); } } void pa...

PRACTICA 2: EJERCICIO 1

Imagen
//-----------------EJERCICIO 1------------------//   //---ÓMEX---//     #include<windows.h> #include<C:\GLUT\include\GL\glut.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #define PI 3.141592653 float cx=363,cy=337,radio=75,radio2=45,radio3=60,radior=44.99,dx,dy; float sc=1,ex=382; int ancho=610,alto=610; void dibujarSIMBOLO(void){ glPushMatrix();     glColor3f(0.90,0.75,0.15);     glBegin(GL_QUADS);     glVertex2i(220,255);glVertex2i(510,365);//P4     glVertex2i(375,495);glVertex2i(220,330);//P3      glEnd();      glPopMatrix(); glPushMatrix();   glColor3f(0.95,0.0,0.10);     glBegin(GL_POLYGON);     for (float i=0; i<2*PI+0.01; i+=0.01)     {         dx=radio*cos(i)+cx;         dy=radio*sin(i)+cy;         glVertex2f(dx, dy); ...

PRACTICA 1: SOL

Imagen
/*------------JOSUÉ HERNÁNDEZ ATONAL-------*/ #include<windows.h> #include<C:\GLUT\include\GL\glut.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #define PI 3.141592653 float cx=375,cy=375,radio=75,radio1=30,dx,dy; float ax=300,ay=280,bx=355,by=280,ex=400,ey=280; float fx=320,fy=292,gx=375,gy=292; float hx=350,hy=303; float sc=1; int ancho=720,alto=710; int px=0,py=0; void dibujarSOL(void){ ///////////////////////////////////////////////////------SOL---------- glPushMatrix();     glPushMatrix();     glColor3f(0.90,0.75,0.0);     glBegin(GL_QUADS);     glVertex2i(300,300);glVertex2i(450,300);     glVertex2i(450,450);glVertex2i(300,450);      glEnd(); glPopMatrix(); glPushMatrix();     glColor3f(0.86,0.75,0.0);     glBegin(GL_QUADS);     glVertex2i(375,269);glVertex2i(481,375);//P4     glVertex2i(375,481)...

BEATS Y MECKEY

Imagen
/*----Josué Hernández Atonal----*/ #include<windows.h> #include<C:\GLUT\include\GL\glut.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #define PI 3.141592653 float cx=500,cy=530.9,radio=70,radio5=36,radio1=40,radio2=60,radio3=110,dx,dy; float ax=566,ay=616,bx=435,by=616; float ex=220,ey=220; float sc=1; int ancho=768,alto=768; int px=0,py=0; void dibujarCereza(void){     glPushMatrix();   glColor3f(0,0,0);      //CARA     glBegin(GL_POLYGON);     for (float i=0; i<2*PI+0.01; i+=0.01)     {         dx=radio*cos(i)+cx;         dy=radio*sin(i)+cy;         glVertex2f(dx, dy);     }     glEnd();     glPopMatrix(); //////////////////////////////////////////////////////////////      glPushMatrix();   glCol...

Algoritmo Bersenham y Algoritmo DDA

Imagen
Algoritmo Bersenham: Un algoritmo preciso y efectivo para la generación de líneas de rastreo, desarrollado por Bresenham, convierte mediante rastreo las líneas al utilizar sólo cálculos incrementales con enteros que se pueden adoptar para desplegar circunferencias y otras curvas. El algoritmo de línea de Bresenham se basa en probar el signo de un parámetro entero, cuyo valor es proporcional a la diferencia entre las separaciones de las dos posiciones de pixel de la trayectoria real de la línea. Para realizar el trazo de línea de Bresenham para una línea con una pendiente positiva menor que 1 se deben seguir los siguientes pasos: 1.Se capturan los dos extremos de la línea y se almacena el extremo izquierdo en ( x 0  , y 0 ). 2.Se carga ( x 0  , y 0 )en el búfer de estructura; es decir, se traza el primer punto. 3.Se calculan las constantes Δ x , Δy, 2Δy  y  2Δy-2Δx  y se obtiene el valor inicial para el parámetro de decisión como  p 0  =...