Adding enforcement of the wanted graphics system GL/GLES

- GRAPHICS=GL/GLES
This commit is contained in:
Thomas-Karl Pietrowski 2014-02-17 22:22:40 +01:00
parent 2e66b17bfc
commit 6adae180a6
1 changed files with 23 additions and 13 deletions

View File

@ -74,6 +74,15 @@ c_options['use_x11'] = False
c_options['use_gstreamer'] = False c_options['use_gstreamer'] = False
c_options['use_avfoundation'] = platform == 'darwin' c_options['use_avfoundation'] = platform == 'darwin'
if environ.get('GRAPHICS') is not None:
print('\nForcing to use this graphics system: %s' %repr(environ.get('GRAPHICS')))
if environ.get('GRAPHICS') == "GL":
c_options['use_opengl_es2'] = False
elif environ.get('GRAPHICS') == "GLES":
c_options['use_opengl_es2'] = True
else:
print("WARNING: Unknown graphics system choosen - using defaults!")
# now check if environ is changing the default values # now check if environ is changing the default values
for key in list(c_options.keys()): for key in list(c_options.keys()):
ukey = key.upper() ukey = key.upper()
@ -177,19 +186,20 @@ elif platform == 'win32':
print('Windows platform detected, force GLEW usage.') print('Windows platform detected, force GLEW usage.')
c_options['use_glew'] = True c_options['use_glew'] = True
else: else:
# searching GLES headers if environ.get('GRAPHICS') is None:
default_header_dirs = ['/usr/include', '/usr/local/include'] # searching GLES headers
found = False default_header_dirs = ['/usr/include', '/usr/local/include']
for hdir in default_header_dirs: found = False
filename = join(hdir, 'GLES2', 'gl2.h') for hdir in default_header_dirs:
if exists(filename): filename = join(hdir, 'GLES2', 'gl2.h')
found = True if exists(filename):
print('Found GLES 2.0 headers at {0}'.format(filename)) found = True
break print('Found GLES 2.0 headers at {0}'.format(filename))
if not found: break
print('WARNING: GLES 2.0 headers are not found') if not found:
print('Fallback to Desktop opengl headers.') print('WARNING: GLES 2.0 headers are not found')
c_options['use_opengl_es2'] = False print('Fallback to Desktop opengl headers.')
c_options['use_opengl_es2'] = False
# check if we are in a kivy-ios build # check if we are in a kivy-ios build
if platform == 'ios': if platform == 'ios':