comparison pytouhou/ui/opengl/backend.pyx @ 593:974decb8df4f

Only selects between GL_TRIANGLE_STRIP and GL_TRIANGLES once, in the backend.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 16 Oct 2014 21:40:54 +0200
parents 19d930f9e3f0
children b7b4a234bf70
comparison
equal deleted inserted replaced
592:19d930f9e3f0 593:974decb8df4f
7 GL_PERSPECTIVE_CORRECTION_HINT, GL_FOG_HINT, GL_NICEST, 7 GL_PERSPECTIVE_CORRECTION_HINT, GL_FOG_HINT, GL_NICEST,
8 GL_COLOR_ARRAY, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY, 8 GL_COLOR_ARRAY, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY,
9 glPushDebugGroup, GL_DEBUG_SOURCE_APPLICATION, glPopDebugGroup, 9 glPushDebugGroup, GL_DEBUG_SOURCE_APPLICATION, glPopDebugGroup,
10 epoxy_gl_version, epoxy_is_desktop_gl, epoxy_has_gl_extension, 10 epoxy_gl_version, epoxy_is_desktop_gl, epoxy_has_gl_extension,
11 GL_PRIMITIVE_RESTART, glPrimitiveRestartIndex, glPixelStorei, 11 GL_PRIMITIVE_RESTART, glPrimitiveRestartIndex, glPixelStorei,
12 GL_PACK_INVERT_MESA) 12 GL_PACK_INVERT_MESA, GL_TRIANGLE_STRIP, GL_TRIANGLES)
13 13
14 14
15 GameRenderer = None 15 GameRenderer = None
16 16
17 17
46 46
47 47
48 def discover_features(): 48 def discover_features():
49 '''Discover which features are supported by our context.''' 49 '''Discover which features are supported by our context.'''
50 50
51 global use_debug_group, use_vao, use_primitive_restart, use_pack_invert, shader_header 51 global use_debug_group, use_vao, use_primitive_restart, use_pack_invert
52 global primitive_mode
53 global shader_header
52 54
53 version = epoxy_gl_version() 55 version = epoxy_gl_version()
54 is_desktop = epoxy_is_desktop_gl() 56 is_desktop = epoxy_is_desktop_gl()
55 57
56 use_debug_group = (is_desktop and version >= 43) or epoxy_has_gl_extension('GL_KHR_debug') 58 use_debug_group = (is_desktop and version >= 43) or epoxy_has_gl_extension('GL_KHR_debug')
57 use_vao = (is_desktop and version >= 30) or epoxy_has_gl_extension('GL_ARB_vertex_array_object') 59 use_vao = (is_desktop and version >= 30) or epoxy_has_gl_extension('GL_ARB_vertex_array_object')
58 use_primitive_restart = (is_desktop and version >= 31) 60 use_primitive_restart = (is_desktop and version >= 31)
59 use_framebuffer_blit = (is_desktop and version >= 30) 61 use_framebuffer_blit = (is_desktop and version >= 30)
60 use_pack_invert = epoxy_has_gl_extension('GL_MESA_pack_invert') 62 use_pack_invert = epoxy_has_gl_extension('GL_MESA_pack_invert')
63
64 primitive_mode = GL_TRIANGLE_STRIP if use_primitive_restart else GL_TRIANGLES
61 65
62 if is_desktop: 66 if is_desktop:
63 # gl_FragColor isn’t supported anymore starting with GLSL 4.2. 67 # gl_FragColor isn’t supported anymore starting with GLSL 4.2.
64 if version >= 42: 68 if version >= 42:
65 version = 41 69 version = 41