Cellular automata in GLSL+PyQT. Various rulesets can be found by checking out individual commits. http://hut.pm/cellmade_gallery.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

44 lines
1.1 KiB

from PyQt5.QtCore import QEvent
from PyQt5 import QtOpenGL
from OpenGL import GLU
from OpenGL.GL import *
from OpenGL.GL import shaders
from PyQt5 import QtGui
from cellmade.lib.fpscounter import FPSCounter
import math
import os
import random
class GLWidget(QtOpenGL.QGLWidget):
def __init__(self, controller):
self.ctrl = controller
self.parent = controller.win
QtOpenGL.QGLWidget.__init__(self, self.parent)
self.show()
def viewInterfaced(self):
w, h = self.ctrl.conf.window.width, self.ctrl.conf.window.height
self.setMinimumSize(w, h)
self.setMaximumSize(w, h)
def viewStandalone(self):
self.setMinimumSize(0, 0)
self.setMaximumSize(99999, 99999)
def initializeGL(self):
self.ctrl.sim.initializeGraphics()
def resizeGL(self, width, height):
if height == 0: height = 1
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
aspect = width / float(height)
GLU.gluPerspective(45.0, aspect, 1.0, 100.0)
glMatrixMode(GL_MODELVIEW)
def paintGL(self):
self.ctrl.sim.draw()