madgui.survey.gl_widget module

Contains a OpenGL widget to display a static scene.

Classes

GLWidget(create_items, *args, **kwargs)

OpenGL widget that shows a static 3D scene, allowing the observer to freely move and look around.

class madgui.survey.gl_widget.GLWidget(create_items, *args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QOpenGLWidget

OpenGL widget that shows a static 3D scene, allowing the observer to freely move and look around.

Attributes

camera_speed

int(x=0) -> integer

mouse_sensitivity

float(x) -> floating point number

update_interval

int(x=0) -> integer

zoom_speed

float(x) -> floating point number

Methods

closeEvent(event)

Free items.

create_scene()

Fetch new items from the given callable.

create_shader_program()

Create simple program with generic fragment/vertex shaders used to render objects with a simple ambient+diffuse lighting model.

free()

Free all items.

hideEvent(event)

Stop scene updates (camera movement).

initializeGL()

Called after first creating a valid OpenGL context.

keyPressEvent(event)

Maintain a list of pressed keys for camera movement.

keyReleaseEvent(event)

Maintain a list of pressed keys for camera movement.

minimumSizeHint(self)

mouseMoveEvent(event)

Handle camera look around.

mousePressEvent(event)

Handle camera look around.

paintGL()

Handle paint event by drawing the items returned by the creator function.

showEvent(event)

Start scene updates (camera movement).

show_gl_info(spec, text)

Show GL version info.

sizeHint(self)

update_event()

Implement camera movement.

wheelEvent(event)

Handle mouse wheel as zoom.

ambient_color = array([0.1, 0.1, 0.1], dtype=float32)
background_color = array([0.6, 0.6, 0.6], dtype=float32)
camera_speed = 1
closeEvent(event)[source]

Free items.

create_scene()[source]

Fetch new items from the given callable.

create_shader_program()[source]

Create simple program with generic fragment/vertex shaders used to render objects with a simple ambient+diffuse lighting model.

diffuse_color = array([1., 1., 1.], dtype=float32)
free()[source]

Free all items.

hideEvent(event)[source]

Stop scene updates (camera movement).

initializeGL()[source]

Called after first creating a valid OpenGL context. Creates shader program, sets up camera and creates an initial scene.

keyPressEvent(event)[source]

Maintain a list of pressed keys for camera movement.

keyReleaseEvent(event)[source]

Maintain a list of pressed keys for camera movement.

minimumSizeHint(self) → QSize[source]
mouseMoveEvent(event)[source]

Handle camera look around.

mousePressEvent(event)[source]

Handle camera look around.

mouse_sensitivity = 0.01
paintGL()[source]

Handle paint event by drawing the items returned by the creator function.

shader_program = None
showEvent(event)[source]

Start scene updates (camera movement).

show_gl_info(spec, text)[source]

Show GL version info.

sizeHint(self) → QSize[source]
update_event()[source]

Implement camera movement. Called regularly.

update_interval = 25
update_timer = None
wheelEvent(event)[source]

Handle mouse wheel as zoom.

zoom_speed = 0.1