comparison pytouhou/ui/opengl/backend.pyx @ 558:94725968dabb

Use vertex array objects, to be compatible with OpenGL 3.1+ core profile.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 12 Dec 2013 13:47:17 +0100
parents 0f2af7552462
children 1be60813f7cb
comparison
equal deleted inserted replaced
557:0f2af7552462 558:94725968dabb
9 9
10 GameRenderer = None 10 GameRenderer = None
11 11
12 12
13 def init(options): 13 def init(options):
14 global flavor, version, major, minor, double_buffer, is_legacy, shader_header, GameRenderer 14 global flavor, version, major, minor, double_buffer, is_legacy, use_vao, shader_header, GameRenderer
15 15
16 flavor_name = options['flavor'] 16 flavor_name = options['flavor']
17 assert flavor_name in ('core', 'es', 'compatibility', 'legacy') 17 assert flavor_name in ('core', 'es', 'compatibility', 'legacy')
18 flavor = (sdl.GL_CONTEXT_PROFILE_CORE if flavor_name == 'core' else 18 flavor = (sdl.GL_CONTEXT_PROFILE_CORE if flavor_name == 'core' else
19 sdl.GL_CONTEXT_PROFILE_ES if flavor_name == 'es' else 19 sdl.GL_CONTEXT_PROFILE_ES if flavor_name == 'es' else
24 major = int(version[0]) 24 major = int(version[0])
25 minor = int(version[2]) 25 minor = int(version[2])
26 26
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 30
30 is_legacy = flavor_name == 'legacy' 31 is_legacy = flavor_name == 'legacy'
31 32
32 try: 33 try:
33 glsl_version = {'2.0': 110, '2.1': 120, '3.0': 130, '3.1': 140, '3.2': 150}[version] 34 glsl_version = {'2.0': 110, '2.1': 120, '3.0': 130, '3.1': 140, '3.2': 150}[version]