コード例 #1
0
ファイル: main.py プロジェクト: tabufellin/image-bmp-liner
from render import Render

#creating object
gl = Render()										#glinit is in the constructor of the class

#just image with noting in it
gl.finish('test1.bmp')							

#now modified to have 600x300 dimensions p
gl.CreateWindow(600,300)								
gl.finish('test2.bmp')										

#from x1 y1 --> to x2 y2 and make a rectangle
gl.viewPort(0, 0, 600, 300)					#ViewPort should be the fourth quadrant of the image
gl.vertex(0,0)
gl.color(1,0,0)	
gl.line(0,0,1,1)									#Should draw a line in the left top corner of the view port. 
gl.line(0,0,1,0)	
gl.line(0,0,1,-1)
gl.line(0,0,0,-1)
gl.line(0,0,-1,0)
gl.line(0,0,-1,-1)
gl.line(0,0,-1,1)
gl.line(0,0,1,0)
gl.line(0,0,0,1)

gl.finish('test.bmp')	
コード例 #2
0
"""
---------------------------------------------------------------------

Universidad del Valle de Guatemala
Saúl Contreras	18409
Gráficas por Computadora
Lab 1: Filling any polygon 

This answer to the problem statement in the lab1
---------------------------------------------------------------------
"""

from render import Render

gl = Render()
gl.CreateWindow(800, 800)

#Polygone 1:
gl.paint([(165, 380), (185, 360), (180, 330), (207, 345), (233, 330),
          (230, 360), (250, 380), (220, 385), (205, 410), (193, 383)],
         gl.rgbToColor(0, 1, 1))

#Polygone 2:
gl.paint([(321, 335), (288, 286), (339, 251), (374, 302)],
         gl.rgbToColor(1, 0, 0))

#Polygone 3:
gl.paint([(377, 249), (411, 197), (436, 249)], gl.rgbToColor(0, 1, 0))

#Polygone 4:
gl.paint([(413, 177), (448, 159), (502, 88), (553, 53), (535, 36), (676, 37),
コード例 #3
0
from render import Render

gl = Render()
gl.CreateWindow(9000, 9000)
gl.clearColor(0, 0, 0)
gl.clear()
gl.color(1, 1, 1)
gl.load('./tarea1/Bowl.obj', (40, 40), (40, 40))
gl.finish('Bigmax.bmp')