Check for required extensions

This commit is contained in:
Kovid Goyal
2016-10-28 12:32:55 +05:30
parent d00e03ca03
commit fabdebfd89
3 changed files with 17 additions and 2 deletions

View File

@@ -13,12 +13,25 @@ from .fonts import render_cell, cell_size
GL_VERSION = (3, 3)
VERSION = GL_VERSION[0] * 100 + GL_VERSION[1] * 10
REQUIRED_EXTENSIONS = frozenset('GL_ARB_copy_image GL_ARB_texture_storage'.split())
def array(*args, dtype=gl.GLfloat):
return (dtype * len(args))(*args)
def check_for_required_extensions():
num = gl.glGetIntegerv(gl.GL_NUM_EXTENSIONS)
required = set(REQUIRED_EXTENSIONS)
for i in range(num):
ext = gl.glGetStringi(gl.GL_EXTENSIONS, i).decode('utf-8')
required.discard(ext)
if not required:
break
if required:
raise RuntimeError('Your OpenGL implementation is missing the following required extensions: %s' % ','.join(required))
class Sprites:
''' Maintain sprite sheets of all rendered characters on the GPU as a texture
array with each texture being a sprite sheet. '''