ColorRGBA(GLubyte red=255, GLubyte green=255, GLubyte blue=255, GLubyte alpha=255)
RGBA color with components stored as unsigned bytes.
Create copy with optional changes.
Unpack color from unsigned int
Return color as float normalized [0.0 - 1.0]
Pack color to a single unsigned int
x.__getitem__(y) <==> x[y]
x.__init__(...) initializes x; see help(type(x)) for signature
x.__len__() <==> len(x)
Scale color components and leaves alpha unchanged
x.__repr__() <==> repr(x)
x.__rmul__(y) <==> y*x
x.__str__() <==> str(x)
alpha: ‘unsigned char’
blue: ‘unsigned char’
green: ‘unsigned char’
red: ‘unsigned char’
Material(int mode=GL_FRONT_AND_BACK, **kwargs)
Abstraction of OpenGL material
Set OpenGL material state
x.__init__(...) initializes x; see help(type(x)) for signature
x.__repr__() <==> repr(x)
x.__str__() <==> str(x)
ambient: gltools.ColorRGBA
diffuse: gltools.ColorRGBA
emissive: gltools.ColorRGBA
mode: ‘int’
shininess: ‘float’
specular: gltools.ColorRGBA
Light(int index=0, Material material=None, Point position=None, directional=True, Vector direction=None)
Abstraction of OpenGL light
Disable light
Enable light and set OpenGL state
x.__init__(...) initializes x; see help(type(x)) for signature
x.__repr__() <==> repr(x)
x.__str__() <==> str(x)
direction: geotools.Vector
directional: ‘int’
index: ‘int’
material: gltools.Material
position: geotools.Point
Image(int width, int height, int format)
Image buffer containing either an RGB/RGBA 8bit channel image.
Width : | image width |
---|---|
Height : | image height |
Format : | gl.RGB or gl.RGBA |
Flip inplace the image in the vertical direction
Write image to PNG file. Note that the file will be overwritten if not locked.
Filename : | image file name |
---|---|
Stride : | stride into buffer |
Raises GLError on failure.
x.__init__(...) initializes x; see help(type(x)) for signature
x.__len__() <==> len(x)
bytesPerPixel: ‘int’
height: ‘int’
width: ‘int’
TextureRect2D(int width, int height, int depth=3)
Abstraction of OpenGL 2d rectangular texture used for keeping a buffer of the screen content.
Blit content of the texture to the back buffer.
Copy buffer content to texture.
Create texture from existing image
x.__init__(...) initializes x; see help(type(x)) for signature
x.__repr__() <==> repr(x)
x.__str__() <==> str(x)
ClientBuffer(target=GL_ARRAY_BUFFER)
Abstraction of OpenGL vertex buffer
The class initialize a single buffer object. The target argument is either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER.
Bind the buffer object and possible set the attribute pointers ig the target is gl.ARRAY_BUFFER and the datatype is defined
Upload data to client side buffer. Passing None for data will reserve capacity.
Data : | None, or any python python object with buffer interface |
---|---|
Size : | size of data to upload. |
Offset : | offset into buffer object |
Set datatye for data in buffer. Only makes sense when target is gl.ARRAY_BUFFER.
Type : | gl.VERTEX_ARRAY, gl.NORMAL_ARRAY or gl.COLOR_ARRAY. |
---|---|
Datatype : | gl.FLOAT, gl.INT etc. |
Datatypesize : | size of datatype. |
Stride : | stride between data |
Pointer : | pointer into buffer object (offser from index 0) |
Unbind the buffer object
x.__init__(...) initializes x; see help(type(x)) for signature
x.__repr__() <==> repr(x)
x.__str__() <==> str(x)
ShaderProgram()
Class to encapsulate compiled GLSL shaders
Set program as current
Compile program source. If no argument is given the default program simulating the fixed pipeline is loaded.
Raises GLError if failed.
Unset program. This will enable the fixed openGL pipeline
Return status
Load named uniform float value
Load named uniform integer value
Load named uniform float vector
Load named uniform matrix value
x.__init__(...) initializes x; see help(type(x)) for signature
x.__repr__() <==> repr(x)
x.__str__() <==> str(x)
Initialize GLFW.
Raise GLError on failure
Terminate GLFW
Get current time since call to Init as float value
Sets current time
Set gamma value
Return desktop size
Window(int width=-1, int height=-1, title=None, int fullscreen=False)
GLFW based window
If width and height are not set then the window is sized to the current desktop size
Stop main loop and close window
Get clipboard text
Get window size
Hide window
Iconify window
Run main loop.
The main loops waits for events. Mouse move events are special handled to avoid to quick update.
Make window openGL context current
Callback non-special key pressed
Callback on close request.
Callback on change of mouse cursor position
Callback on mouse pointer enter/leave event
Callback on windows focus change
Callback on iconify status change
Callback on key press or relase.
Callback on mouse button press or release
Callback when refresh of content is requested
Callback on mouse scroll wheel
Callback when size changes
Restore window from iconification
Set clipboard text
Set window size
Set window title
Show window
Swap front and back buffers
x.__init__(...) initializes x; see help(type(x)) for signature
running: ‘int’
UI()
Draw UI elements
Return true if any ui element is active
Begin fixed area
Start frame
Begin scroll area
Up to 10 scroll areas can be used, but not nested.
Button element
Check box element
Collapse element
Draw single line
Draw rectangle
Draw rounded rectangle
Draw text
End fixed area
End frame
End scroll area
Flush drawing pipeline
Indent current x position
Item element
Text label (left aligned)
Add horisontal separator space
Add horisontal separator line
Horisontal slider
Unindent current x position
Text label (right aligned)
x.__init__(...) initializes x; see help(type(x)) for signature
Initialize OpenGL 2.1 extension
Raise GLError if extensions not found
Check for OpenGL errors.
Raises GLError.
Start text drawing
Draw text
Size : | font size |
---|---|
X : | x coordinate |
Y : | y coordinate |
Text : | text (must encode to UTF-8) |
Finish text drawing. This will flush any pending text drawing operations.
Set global ambient light color.
Specify pixel arithmetic
Sfactor : | Specifies how the red, green, blue, and alpha source blending factors are computed. The initial value is GL_ONE. |
---|---|
Dfactor : | Specifies how the red, green, blue, and alpha destination blending factors are computed. gl.ONE_MINUS_SRC_COLOR etc. |
Clear selected buffers to preset values.
Mask : | bit flags are gl.COLOR_BUFFER_BIT, gl.DEPTH_BUFFER_BIT, and gl.STENCIL_BUFFER_BIT |
---|
Specify clear values for the color buffers
Specify the clear value for the depth buffer
Sets the current color.
Disable server-side GL capabilities
Render primitives from array data
Mode : | Primitive type gl.POINTS, gl.LINE_STRIP, etc. |
---|---|
First : | Specifies the starting index in the enabled arrays. |
Count : | Specifies the number of indices to be rendered. |
Render primitives from array data with indices.
Mode : | Primitive type gl.POINTS, gl.LINE_STRIP, etc. |
---|---|
Count : | Specifies the number of indices to be rendered. |
Type : | Indices data type. One of gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT, or gl.UNSIGNED_INT |
Indices : | Either a python object with valid buffer interface or and integer as a pointer into a already bound ClientBuffer of element array type. |
specify implementation-specific hints
Enable server-side GL capabilities
Specify the width of rasterized lines
Sets lighting model parameters.
Replace the current matrix with the identity matrix
Replace the current matrix with given matrix.
Specify which matrix is the current matrix
Mode : | gl.MODELVIEW, gl.PROJECTION, or gl.TEXTURE |
---|
Multiply the current matrix with an orthographic matrix
Left : | Specify the coordinates for the left vertical clipping plane. |
---|---|
Right : | Specify the coordinates for the vertical clipping plane. |
Bottom : | Specify the coordinates for the bottom horizontal clipping plane. |
Top : | Specify the coordinates for the top horizontal clipping plane. |
Znear : | Specify the distances to the nearer clipping plane. |
Zfar : | Specify the distances to the farther depth clipping plane. |
Select a polygon rasterization mode
Set the scale and units used to calculate depth values
Factor : | Specifies a scale factor that is used to create a variable depth offset for each polygon. |
---|---|
Units : | Is multiplied by an implementation-specific value to create a constant depth offset. |
Read a sigle pixel from the frame buffer.
Read a block of pixels from the frame buffer
Set the viewport
X : | x coordiante of lower left corner. |
---|---|
Y : | y coordiante of lower left corner. |
Width : | viewport width |
Height : | viewport height |