Orthographic¶
-
class
glumpy.transforms.
OrthographicProjection
(*args, **kwargs)¶ Bases:
glumpy.transforms.transform.Transform
Orthographic projection (or orthogonal projection) is a means of representing a three-dimensional object in two dimensions. It is a form of parallel projection, where all the projection lines are orthogonal to the projection plane, resulting in every plane of the scene appearing in affine transformation on the viewing surface.
Parameters: - aspect (float) – Aspect ratio (width/height). Default is None.
- xinvert (bool) – Whether to invert X axis. Default is False.
- yinvert (bool) – Whether to invert Y axis. Default is False.
- znear (int) – Z near clipping place. Default is -1000.
- zfar (int) – Z far clipping place. Default is +1000.
- normalize (bool) – Whether to use normalized device coordinates. Default is False
The transform is connected to the following events:
on_attach
: Transform initializationon_resize
: Recompute projection matrix
Usage example
vertex = ''' attribute vec2 position; void main() { gl_Position = <transform>; } ''' fragment = ''' void main() { gl_FragColor = vec4(1,0,0,1); } ''' window = app.Window() @window.event def on_draw(dt): window.clear() quad.draw(gl.GL_TRIANGLE_STRIP) @window.event def on_resize(w, h): quad['position'] = [(w-100,h-100), (w-100,h), (w,h-100), (w,h)] quad = gloo.Program(vertex, fragment, count=4) quad["transform"] = OrthographicProjection(Position("position")) window.attach(quad["transform"]) app.run()
-
aspect
¶ Aspect ratio
-
normalize
¶ Whether to use normalized coordinates
-
xinvert
¶ Whether to invert x axis
-
yinvert
¶ Whether to invert y axis
-
zfar
¶ Z far clipping place
-
znear
¶ Z near clipping place