Mercurial > touhou
diff pytouhou/ui/opengl/backend.pyx @ 557:0f2af7552462
Don’t hardcode GLSL version in our shaders, instead make them dependent on GL version.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 30 May 2014 16:40:36 +0200 |
parents | c34b23e29d16 |
children | 94725968dabb |
line wrap: on
line diff
--- a/pytouhou/ui/opengl/backend.pyx +++ b/pytouhou/ui/opengl/backend.pyx @@ -11,7 +11,7 @@ GameRenderer = None def init(options): - global flavor, version, major, minor, double_buffer, is_legacy, GameRenderer + global flavor, version, major, minor, double_buffer, is_legacy, shader_header, GameRenderer flavor_name = options['flavor'] assert flavor_name in ('core', 'es', 'compatibility', 'legacy') @@ -29,6 +29,12 @@ def init(options): is_legacy = flavor_name == 'legacy' + try: + glsl_version = {'2.0': 110, '2.1': 120, '3.0': 130, '3.1': 140, '3.2': 150}[version] + except KeyError: + glsl_version = 100 * major + 10 * minor + shader_header = '#version %d\n' % glsl_version + #TODO: check for framebuffer/renderbuffer support. from pytouhou.ui.opengl.gamerenderer import GameRenderer