From f9d83a2add9f9eaa6aff59ed597f6739f50f6686 Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 23 Aug 2018 00:38:14 -0400 Subject: [PATCH] Show better renderer information. --- punyverse/__main__.py | 2 +- punyverse/game.py | 18 ++++++++++++------ punyverse/texture.py | 18 ++++-------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/punyverse/__main__.py b/punyverse/__main__.py index 393bf8f..e420099 100644 --- a/punyverse/__main__.py +++ b/punyverse/__main__.py @@ -38,7 +38,7 @@ def main(): if hasattr(config, '_attribute_names'): print('OpenGL configuration:') for key in config._attribute_names: - print(' %-17s %s' % (key + ':', getattr(config, key))) + print(' %-22s %s' % (key + ':', getattr(config, key))) world_options = { 'normal': args.normal, diff --git a/punyverse/game.py b/punyverse/game.py index fdbe7c7..f242130 100644 --- a/punyverse/game.py +++ b/punyverse/game.py @@ -51,28 +51,34 @@ class Applet(pyglet.window.Window): texture.init() if hasattr(self.config, '_attribute_names'): - info = [' %-22s %s' % (key + ':', getattr(self.config, key)) - for key in self.config._attribute_names] + info = [' %-22s %s' % (key + ':', value) + for key, value in self.config.get_gl_attributes()] info = ['%-30s %-30s' % group for group in zip_longest(info[::2], info[1::2], fillvalue='')] info = 'OpenGL configuration:\n' + '\n'.join(info) else: info = 'Unknown OpenGL configuration' + info = '\n'.join([ + 'Graphics Vendor: ' + gl_info.get_vendor(), + 'Graphics Version: ' + gl_info.get_version(), + 'Graphics Renderer: ' + gl_info.get_renderer(), + ]) + '\n\n' + info + self.loaded = False self.__load_started = False self._loading_phase = pyglet.text.Label( - font_name='Consolas', font_size=20, x=10, y=self.height - 80, + font_name='Consolas', font_size=20, x=10, y=self.height - 50, color=(255, 255, 255, 255), width=self.width - 20, align='center', multiline=True, text='Punyverse is starting...' ) self._loading_label = pyglet.text.Label( - font_name='Consolas', font_size=16, x=10, y=self.height - 150, + font_name='Consolas', font_size=16, x=10, y=self.height - 120, color=(255, 255, 255, 255), width=self.width - 20, align='center', multiline=True ) self._info_label = pyglet.text.Label( - font_name='Consolas', font_size=13, x=10, y=self.height - 250, + font_name='Consolas', font_size=13, x=10, y=self.height - 220, color=(255, 255, 255, 255), width=self.width - 20, multiline=True, text=info ) @@ -376,7 +382,7 @@ class Applet(pyglet.window.Window): self._loading_phase.draw() self._loading_label.draw() if progress is not None: - progress_bar(10, self.height - 170, self.width - 20, 50, progress) + progress_bar(10, self.height - 140, self.width - 20, 50, progress) self._info_label.draw() def on_draw(self, glMatrixBuffer=GLfloat * 16): diff --git a/punyverse/texture.py b/punyverse/texture.py index 28aacee..4f5243a 100644 --- a/punyverse/texture.py +++ b/punyverse/texture.py @@ -74,12 +74,7 @@ def init(): buf = c_int() glGetIntegerv(GL_MAX_TEXTURE_SIZE, byref(buf)) max_texture = buf.value - badcard = gl_info.get_renderer() in ('GDI Generic',) - if badcard: - import warnings - warnings.warn('Please update your graphics drivers if possible') - - # bgra = gl_info.have_extension('GL_EXT_bgra') + bgra = gl_info.have_extension('GL_EXT_bgra') if power_of_two is None: power_of_two = gl_info.have_version(2) or gl_info.have_extension('GL_ARB_texture_non_power_of_two') @@ -229,14 +224,9 @@ def load_texture(file): glBindTexture(GL_TEXTURE_2D, id) - if badcard: - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) - glTexImage2D(GL_TEXTURE_2D, 0, mode, width, height, 0, mode, GL_UNSIGNED_BYTE, texture) - else: - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR) - gluBuild2DMipmaps(GL_TEXTURE_2D, depth, width, height, mode, GL_UNSIGNED_BYTE, texture) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR) + gluBuild2DMipmaps(GL_TEXTURE_2D, depth, width, height, mode, GL_UNSIGNED_BYTE, texture) cache[path] = id return id