22 lines
833 B
Python
22 lines
833 B
Python
|
from OpenGL.GLUT import *
|
||
|
from OpenGL.GLU import *
|
||
|
from OpenGL.GL import *
|
||
|
from Objects.Objects import *
|
||
|
import numpy as np
|
||
|
|
||
|
class Cube(Object):
|
||
|
GeometryShaderId = -1
|
||
|
def __init__(self):
|
||
|
Object.__init__(self)
|
||
|
if(Cube.GeometryShaderId == -1):
|
||
|
self.initializeShader()
|
||
|
def initializeShader(self)->bool:
|
||
|
with open('./Objects/Cube/cube_geometry.glsl', 'r') as f:
|
||
|
geometry_shader_string = f.read()
|
||
|
Cube.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 False
|
||
|
return True
|