This commit is contained in:
Kovid Goyal
2017-09-10 18:21:16 +05:30
parent 9c184c794a
commit c1dc4d0575
2 changed files with 16 additions and 9 deletions

View File

@@ -37,8 +37,8 @@ BASE = os.path.dirname(os.path.abspath(__file__))
@lru_cache()
def load_shaders(name):
vert = open(os.path.join(BASE, '{}_vertex.glsl'.format(name))).read()
frag = open(os.path.join(BASE, '{}_fragment.glsl'.format(name))).read()
vert = open(os.path.join(BASE, '{}_vertex.glsl'.format(name))).read().replace('GLSL_VERSION', str(GLSL_VERSION), 1)
frag = open(os.path.join(BASE, '{}_fragment.glsl'.format(name))).read().replace('GLSL_VERSION', str(GLSL_VERSION), 1)
return vert, frag
@@ -244,11 +244,7 @@ class ShaderProgram: # {{{
Create a shader program.
"""
self.program_id = compile_program(
which,
vertex.replace('GLSL_VERSION', str(GLSL_VERSION), 1),
fragment.replace('GLSL_VERSION', str(GLSL_VERSION), 1)
)
self.program_id = compile_program(which, vertex, fragment)
self.vertex_arrays = {}
@contextmanager