from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GL import * from Objects.Objects import * class Cuboid(Object): GeometryShaderId = -1 def __init__(self): Object.__init__(self) if(Cuboid.GeometryShaderId == -1): self.initializeShader() def initializeShader(self)->bool: with open('./Objects/Cuboid/cuboid_geometry.glsl', 'r') as f: geometry_shader_string = f.read() Cuboid.GeometryShaderId = glCreateShader(GL_GEOMETRY_SHADER) glShaderSource(Cuboid.GeometryShaderId, geometry_shader_string) glCompileShader(Cuboid.GeometryShaderId) if glGetShaderiv(Cuboid.GeometryShaderId, GL_COMPILE_STATUS) != GL_TRUE: raise RuntimeError(glGetShaderInfoLog(Cuboid.GeometryShaderId)) return False return True