from gl import Render, color r = Render(900, 600) polygon1 = [(165, 380), (185, 360), (180, 330), (207, 345), (233, 330), (230, 360), (250, 380), (220, 385), (205, 410), (193, 383)] polygon2 = [(321, 335), (288, 286), (339, 251), (374, 302)] polygon3 = [(377, 249), (411, 197), (436, 249)] polygon4 = [(413, 177), (448, 159), (502, 88), (553, 53), (535, 36), (676, 37), (660, 52), (750, 145), (761, 179), (672, 192), (659, 214), (615, 214), (632, 230), (580, 230), (597, 215), (552, 214), (517, 144), (466, 180),] polygon5 = [(682, 175), (708, 120), (735, 148), (739, 170)] r.glDrawPolygon(polygon1) r.glDrawPolygon(polygon2) r.glDrawPolygon(polygon3) r.glDrawPolygon(polygon4) r.glColor(0, 0, 0) r.glDrawPolygon(polygon5) r.glFinish()
from obj import Obj r = Render(1000, 800) poly1 = [(165, 380), (185, 360), (180, 330), (207, 345), (233, 330), (230, 360), (250, 380), (220, 385), (205, 410), (193, 383)] poly2 = [(321, 335), (288, 286), (339, 251), (374, 302)] poly3 = [(377, 249), (411, 197), (436, 249)] poly4 = [(413, 177), (448, 159), (502, 88), (553, 53), (535, 36), (676, 37), (660, 52), (750, 145), (761, 179), (672, 192), (659, 214), (615, 214), (632, 230), (580, 230), (597, 215), (552, 214), (517, 144), (466, 180)] poly5 = [(682, 175), (708, 120), (735, 148), (739, 170)] r.glColor(0,1,1) r.glDrawPolygon(poly1) r.glFillPolygon(poly1) r.glColor(1,0,0) r.glDrawPolygon(poly2) r.glFillPolygon(poly2) r.glColor(1,0,1) r.glDrawPolygon(poly3) r.glFillPolygon(poly3) r.glColor(0.5,1,0) r.glDrawPolygon(poly4) r.glFillPolygon(poly4) r.glColor(0.5,0.5,0)
#Andree Toledo 18439 #Laboratorio Filling polygon from gl import Render BLACK = (0, 0, 0) render = Render() render.glCreateWindow(900, 500) # Screen size render.glClearColor(0, 0, 0) # Black # Rendering polygons render.glColor(0.39, 0.72, 1) # BLUE render.glDrawPolygon([(165, 380), (185, 360), (180, 330), (207, 345), (233, 330), (230, 360), (250, 380), (220, 385), (205, 410), (193, 383)]) render.glFillPolygon() render.glColor(0.39, 0.72, 1) # BLUE render.glDrawPolygon([(321, 335), (288, 286), (339, 251), (374, 302)]) render.glFillPolygon() render.glColor(0.39, 0.72, 1) # BLUE render.glDrawPolygon([(377, 249), (411, 197), (436, 249)]) render.glFillPolygon() render.glColor(0.88, 0.25, 0.01) # RED render.glDrawPolygon([(413, 177), (448, 159), (502, 88), (553, 53), (535, 36), (676, 37), (660, 52), (750, 145), (761, 179), (672, 192), (659, 214), (615, 214), (632, 230), (580, 230), (597, 215), (552, 214), (517, 144), (466, 180)])
p3 = [(377, 249), (411, 197), (436, 249)] p4 = [(413, 177), (448, 159), (502, 88), (553, 53), (535, 36), (676, 37), (660, 52), (750, 145), (761, 179), (672, 192), (659, 214), (615, 214), (632, 230), (580, 230), (597, 215), (552, 214), (517, 144), (466, 180)] p5 = [(682, 175), (708, 120), (735, 148), (739, 170)] print("A continuación se graficarán y se llenarán polígonos ") enter = input("Apache ENTER para continuar...") ## changes the color to yellow render.glColor(1, 1, 0) render.glDrawPolygon(p1) ## changes the color to blue render.glColor(0, 0, 1) render.glDrawPolygon(p2) ## changes the color to green render.glColor(0, 1, 0) render.glDrawPolygon(p3) ## changes the color to red render.glColor(1, 0, 0) render.glDrawPolygon(p4) ## changes the color to white render.glColor(1, 1, 1)