xpgl¶
X-Plane permits the use of OpenGL for drawing two dimensional objects. This can include drawing directly on the screen
(xp.registerDrawCallback()), within windows (xp.draw()), or within avionics windows (xp.screenDraw()).
X-Plane sets up the proper OpenGL context and you pass in a callback function to do the actually drawing.
However, OpenGL is a complicated API which is powerful, yet does not do simple things simply.
This module attempts to reduce the pain of OpenGL.
Caution
The module is a work-in-progress. While I do not expect the interface to change much, if you require stability, you should test and ship with your own copy of this module. Better yet, if you see an issue, let me know so we can all benefit!
To use:
from XPPython3 import xpgl
The functions below are grouped:
xpgl Lines: single lines, sets of connected lines, different thicknesses and with stipple patterns.
xpgl Shapes: lines configured as circles, rectangles and other polygons, filled or outlined only.
xpgl Images: Textures, read from image files
xpgl Text: Loading fonts and displaying text with different styles, sizes, and colors
xpgl Transformations: Transform part of a drawing using rotation, translation, and scaling
xpgl Mask and Stencil: Alter the drawing by showing or hiding part of it using a mask
Constants¶
- Colors¶
Colors is large dictionary of pre-defined colors, you may find these convenient to use, but there is nothing special about them.
To use:
>>> from XPPython3.xpgl import Colors >>> Colors['orange'] (1, 0.5, 0.0)
- class RGBColor¶
Each color is three-element tuple with floating point values in range [0..1].
