mirror of
https://github.com/scrtwpns/mixbox.git
synced 2026-03-19 22:49:41 +01:00
add mixbox for python
This commit is contained in:
29
python/examples/opengl.py
Normal file
29
python/examples/opengl.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import pygame as pg
|
||||
from pygame.locals import *
|
||||
|
||||
from OpenGL.GL import *
|
||||
from OpenGL.GLU import *
|
||||
|
||||
import mixbox
|
||||
|
||||
pg.init()
|
||||
pg.display.set_mode((640, 480), DOUBLEBUF | OPENGL)
|
||||
|
||||
while True:
|
||||
rgb1 = (0.0, 0.129, 0.522) # blue
|
||||
rgb2 = (0.988, 0.827, 0.0) # yellow
|
||||
|
||||
n = 640
|
||||
glBegin(GL_LINES)
|
||||
for i in range(0, n+1):
|
||||
glColor(mixbox.lerp_float(rgb1, rgb2, i / n))
|
||||
glVertex((i / n)*2 - 1, -1)
|
||||
glVertex((i / n)*2 - 1, +1)
|
||||
glEnd()
|
||||
|
||||
pg.display.flip()
|
||||
|
||||
for event in pg.event.get():
|
||||
if event.type == pg.QUIT:
|
||||
pg.quit()
|
||||
quit()
|
||||
Reference in New Issue
Block a user