comparison pytouhou/ui/opengl/backend.pyx @ 559:1be60813f7cb

Get OpenGL ES 2.0 to work thanks to libepoxy. PCB textures will need swizzle in the shaders since BGRA isn’t natively supported on GLES.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 30 May 2014 16:40:36 +0200
parents 94725968dabb
children b8df946d394d
comparison
equal deleted inserted replaced
558:94725968dabb 559:1be60813f7cb
27 maybe_double_buffer = options['double-buffer'] 27 maybe_double_buffer = options['double-buffer']
28 double_buffer = maybe_double_buffer if maybe_double_buffer is not None else -1 28 double_buffer = maybe_double_buffer if maybe_double_buffer is not None else -1
29 use_vao = (major == 3 and minor >= 1) or major > 3 29 use_vao = (major == 3 and minor >= 1) or major > 3
30 30
31 is_legacy = flavor_name == 'legacy' 31 is_legacy = flavor_name == 'legacy'
32 is_gles = flavor_name == 'es'
32 33
33 try: 34 if not is_gles:
34 glsl_version = {'2.0': 110, '2.1': 120, '3.0': 130, '3.1': 140, '3.2': 150}[version] 35 try:
35 except KeyError: 36 glsl_version = {'2.0': 110, '2.1': 120, '3.0': 130, '3.1': 140, '3.2': 150}[version]
36 glsl_version = 100 * major + 10 * minor 37 except KeyError:
37 shader_header = '#version %d\n' % glsl_version 38 assert (major == 3 and minor == 3) or major > 3
39 glsl_version = 100 * major + 10 * minor
40 shader_header = '#version %d\n' % glsl_version
41 else:
42 glsl_version = {'2.0': 100, '3.0': 300}[version]
43 shader_header = '#version %d\n\nprecision highp float;\n' % glsl_version
38 44
39 #TODO: check for framebuffer/renderbuffer support. 45 #TODO: check for framebuffer/renderbuffer support.
40 46
41 from pytouhou.ui.opengl.gamerenderer import GameRenderer 47 from pytouhou.ui.opengl.gamerenderer import GameRenderer
42 48