def star(width, height): r = Render.glInit(width, height) r.glClear() r.glColor(1, 1, 1) # Lines r.glLine(0, 0, 1, 0) r.glLine(0, 0, 0, 1) r.glLine(0, 0, -1, 0) r.glLine(0, 0, 0, -1) r.glLine(0, 0, 1, 1) r.glLine(0, 0, 1, -1) r.glLine(0, 0, -1, 1) r.glLine(0, 0, -1, -1) r.glLine(0, 0, 0.5, 1) r.glLine(0, 0, 1, 0.5) r.glLine(0, 0, 1, -0.5) r.glLine(0, 0, 0.5, -1) r.glLine(0, 0, -0.5, 1) r.glLine(0, 0, -1, 0.5) r.glLine(0, 0, -1, -0.5) r.glLine(0, 0, -0.5, -1) r.glLine(0, 0, 0.25, 1) r.glLine(0, 0, 0.75, 1) r.glLine(0, 0, 1, 0.75) r.glLine(0, 0, 1, 0.25) r.glLine(0, 0, 0.25, -1) r.glLine(0, 0, 0.75, -1) r.glLine(0, 0, 1, -0.75) r.glLine(0, 0, 1, -0.25) r.glLine(0, 0, -0.25, -1) r.glLine(0, 0, -0.75, -1) r.glLine(0, 0, -1, -0.75) r.glLine(0, 0, -1, -0.25) r.glLine(0, 0, -0.25, 1) r.glLine(0, 0, -0.75, 1) r.glLine(0, 0, -1, 0.75) r.glLine(0, 0, -1, 0.25) r.glFinish()
from gl import Render, color r = Render() r.glInit() r.glClearColor(1, 0, 0) r.glCreateWindow(800, 600) def line(x1, y1, x2, y2): dy = (y2 - y1) dx = abs(x2 - x1) steep = dy > dx if steep: x1, y1 = y1, x1 x2, y2 = y2, x2 if x1 > x2: x1, x2 = x2, x1 y1, y2 = y2, y1 dy = abs(y2 - y1) dx = abs(x2 - x1) offset = 0 threshold = 1 * dx y = y1 for x in range(x1, x2): if steep: r.point(y, x)
#Michael Chan 18562 #Graficas por computadora #SR4FlatShading from gl import Render modelName = input('Ingrese el path del modelo: ') r = Render() r.glInit(800, 600) r.load(modelName, [2, 2, 1], [150, 150, 150]) r.glFinish("SR4.bmp")
from gl import Render from obj import Texture from collections import namedtuple from math import pi import random V2 = namedtuple('Point2', ['x', 'y']) V3 = namedtuple('Point3', ['x', 'y', 'z']) r = Render() r.glInit(1000,1000) r.lookAt(V3(1, 0, 1), V3(0, 0, 0), V3(0, 1, 0)) r.load('./sphere.obj', translate=(10,10,10), scale=(1.1,1,1.1), rotate=(0,0,0)) r.drawArrays('SHADER') r.load('./sphere.obj', translate=(6,-3,6), scale=(0.1,0.1,0.1), rotate=(0,0,0)) r.drawArrays('SHADER') r.load('./sphere.obj', translate=(5,0,6), scale=(0.1,0.1,0.1), rotate=(0,0,0)) r.drawArrays('SHADER') r.load('./sphere.obj', translate=(4,-1,2), scale=(0.038,0.038,0.038), rotate=(0,0,0)) r.drawArrays('SHADER') r.load('./sphere.obj', translate=(3,-1,2), scale=(0.03,0.03,0.03), rotate=(0,0,0)) r.drawArrays('SHADER') r.load('./sphere.obj', translate=(4,-1,6), scale=(0.085,0.085,0.085), rotate=(0,0,0)) r.drawArrays('SHADER')
5. Draw Line 98. Data 99.Finish """) continuar = True while continuar: menu() print("Tomar en cuenta que por ahora el window debe ser cuadrado") option = input('Ingresa un numero: ') if option == '1': finish = False render = Render.glInit(64, 64) while not finish: menu_draw() option2 = input('Ingresa un numero: ') if option2 == '1': w = int(input('Ingrese un ancho: ')) h = int(input('Ingrese una altura: ')) render.glCreateWindow(w, h) elif option2 == '2': x = int(input('Ingrese una posicion inicial x: ')) y = int(input('Ingrese una posicion inicial y: ')) w = int(input('Ingrese un ancho: ')) h = int(input('Ingrese una altura: ')) render.glViewPort(x, y, w, h)