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