aboutsummaryrefslogtreecommitdiffstats
path: root/examples/opengl
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 10:09:33 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-29 13:21:52 +0200
commitdf43156bb35a442c4988631e1c2b0bd0fc11e618 (patch)
tree77e6c531967013e5628f04e48ba035197b8a737c /examples/opengl
parent130e79e4658d2438f66ab8aeb5e186349e3cb740 (diff)
Examples: Fix some space-related flake warnings
Task-number: PYSIDE-1112 Change-Id: Ib8991199e4822673d6a25cba0023dbe3b03f5938 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/opengl')
-rw-r--r--examples/opengl/contextinfo/contextinfo.py11
-rw-r--r--examples/opengl/hellogl2/hellogl2.py6
2 files changed, 11 insertions, 6 deletions
diff --git a/examples/opengl/contextinfo/contextinfo.py b/examples/opengl/contextinfo/contextinfo.py
index d115637c5..ed7b8ca72 100644
--- a/examples/opengl/contextinfo/contextinfo.py
+++ b/examples/opengl/contextinfo/contextinfo.py
@@ -106,8 +106,8 @@ fragment_shader_source = dedent("""
}
""")
-vertices = numpy.array([0, 0.707, -0.5, -0.5, 0.5, -0.5], dtype = numpy.float32)
-colors = numpy.array([1, 0, 0, 0, 1, 0, 0, 0, 1], dtype = numpy.float32)
+vertices = numpy.array([0, 0.707, -0.5, -0.5, 0.5, -0.5], dtype=numpy.float32)
+colors = numpy.array([1, 0, 0, 0, 1, 0, 0, 0, 1], dtype=numpy.float32)
def print_surface_format(surface_format):
@@ -116,6 +116,7 @@ def print_surface_format(surface_format):
minor = surface_format.minorVersion()
return f"{profile_name} version {major}.{minor}"
+
class RenderWindow(QWindow):
def __init__(self, format):
super().__init__()
@@ -170,7 +171,7 @@ class RenderWindow(QWindow):
self.vbo.release()
vao_binder = QOpenGLVertexArrayObject.Binder(self.vao)
- if self.vao.isCreated(): # have VAO support, use it
+ if self.vao.isCreated(): # have VAO support, use it
self.setup_vertex_attribs()
def setup_vertex_attribs(self):
@@ -216,7 +217,7 @@ class RenderWindow(QWindow):
if self.vao.isCreated():
self.vao.bind()
- else: # no VAO support, set the vertex attribute arrays now
+ else: # no VAO support, set the vertex attribute arrays now
self.setup_vertex_attribs()
functions.glDrawArrays(GL.GL_TRIANGLES, 0, 3)
@@ -247,6 +248,7 @@ class RenderWindow(QWindow):
self.context.doneCurrent()
return text
+
class MainWindow(QWidget):
def __init__(self):
super().__init__()
@@ -266,6 +268,7 @@ class MainWindow(QWidget):
text = f"{build}\n\nPython {sys.version}\n\n{gl}"
self._plain_text_edit.setPlainText(text)
+
if __name__ == '__main__':
parser = ArgumentParser(description="contextinfo", formatter_class=RawTextHelpFormatter)
parser.add_argument('--gles', '-g', action='store_true',
diff --git a/examples/opengl/hellogl2/hellogl2.py b/examples/opengl/hellogl2/hellogl2.py
index bad59cba3..a4ef3314e 100644
--- a/examples/opengl/hellogl2/hellogl2.py
+++ b/examples/opengl/hellogl2/hellogl2.py
@@ -121,11 +121,12 @@ class Window(QWidget):
else:
super(Window, self).keyPressEvent(event)
+
class Logo():
def __init__(self):
self.m_count = 0
self.i = 0
- self.m_data = numpy.empty(2500 * 6, dtype = ctypes.c_float)
+ self.m_data = numpy.empty(2500 * 6, dtype=ctypes.c_float)
x1 = +0.06
y1 = -0.14
@@ -223,6 +224,7 @@ class Logo():
self.i += 1
self.m_count += 6
+
class GLWidget(QOpenGLWidget, QOpenGLFunctions):
x_rotation_changed = Signal(int)
y_rotation_changed = Signal(int)
@@ -334,7 +336,6 @@ class GLWidget(QOpenGLWidget, QOpenGLFunctions):
fragColor = vec4(col, 1.0);
}"""
-
def vertex_shader_source(self):
return """attribute vec4 vertex;
attribute vec3 normal;
@@ -459,6 +460,7 @@ class GLWidget(QOpenGLWidget, QOpenGLFunctions):
self._last_pos = pos
+
if __name__ == '__main__':
app = QApplication(sys.argv)
parser = ArgumentParser(description="hellogl2", formatter_class=RawTextHelpFormatter)