145. opengl.gl — OpenGL access functions

All calls to opengl functions are collected here, so we can easily select different gl engines.

145.1. Functions defined in module opengl.gl

opengl.gl.gl_projection()[source]

Get the OpenGL projection matrix

opengl.gl.gl_modelview()[source]

Get the OpenGL modelview matrix

opengl.gl.gl_viewport()[source]

Return the current OpenGL Viewport

Returns a tuple x,y,w,h specifying the position and size of the current OpenGL viewport (in pixels).

opengl.gl.gl_loadmodelview(m)[source]

Load the OpenGL modelview matrix

opengl.gl.gl_loadprojection(m)[source]

Load the OpenGL projection matrix

opengl.gl.gl_depth(x, y)[source]

Read the depth value of the pixel at (x,y)

opengl.gl.gl_linestipple(factor, pattern)[source]

Set the line stipple pattern.

When drawing lines, OpenGl can use a stipple pattern. The stipple is defined by two values: a pattern (on/off) of maximum 16 bits, used on the pixel level, and a multiplier factor for each bit.

If factor <= 0, the stippling is disabled.

opengl.gl.gl_smooth(smooth=True)[source]

Enable smooth shading

opengl.gl.gl_flat()[source]

Disable smooth shading

opengl.gl.onOff(onoff)[source]

Convert On/Off strings to a boolean

opengl.gl.gl_enable(facility, onoff)[source]

Enable/Disable an OpenGL facility, depending on onoff value

facility is an OpenGL facility. onoff can be True or False to enable, resp. disable the facility, or None to leave it unchanged.