MasterScan
Lab_Matlab_control Master Branch
|
Draw OpenGL vertices as arbitrary shapes, using buffer objects.
dotsDrawableVertices creates and maintains OpenGL buffer objects which can store vertex data. The vertex data can be used to draw OpenGL graphics primitives including points, lines, and polygons. Each vertex may have its own color. Primitives can be scaled, rotated, and translated using OpenGL functionality.
Properties and Events | |
Property | x = 0 |
vertex x-positions (x, y, and z must be scalar or match sizes) | |
Property | y = 0 |
vertex y-positions (x, y, and z must be scalar or match sizes) | |
Property | z = 0 |
vertex z-positions (x, y, and z must be scalar or match sizes) | |
Property | colors = [1 1 1] |
color map to use for vertices [r g b a; r g b a; etc. More... | |
Property | isColorByVertexGroup = false |
whether to color vertices in groups(true) or individually(false) | |
Property | indices = [] |
array of indices for selecting, reusing, and reordering vertices More... | |
Property | pixelSize = 1 |
width in pixels for points or lines | |
Property | isSmooth = false |
whether to use anti-aliasing for primitives | |
Property | primitive = 0 |
index to choose OpenGL vertex drawing mode More... | |
Property | usageHint = 3 |
index to choose usage "hint" for OpenGL buffers More... | |
Property | translation = [] |
optional translation to apply to vertex positions [tX tY tZ] More... | |
Property | rotation = [] |
optional rotation of vertices about coordinate axes [rX rY rZ] More... | |
Property | scaling = [] |
optional scaling to apply to vertex positions [sX sY sZ] More... | |
![]() | |
Property | isVisible = true |
true or false, whether to draw() this object | |
Protected Properties | |
Property | attribBufferInfo = [] |
identifier and other info for the OpenGL vertex attribute buffer | |
Property | isAttribBufferStale = true |
whether or not the attribute buffer is out of date | |
Property | indexBufferInfo = [] |
identifier and other info for the OpenGL vertex index buffer | |
Property | isIndexBufferStale = true |
whether or not the index buffer is out of date | |
Property | colorBufferInfo = [] |
identifier and other info for the OpenGL vertex color buffer | |
Property | isColorBufferStale = true |
whether or not the color buffer is out of date | |
Property | smoothMap |
map primitive integers to dotsMglSmoothness() switches | |
Methods | |
self | dotsDrawableVertices () |
Constructor takes no arguments. | |
delete (self) | |
Release OpenGL resources. More... | |
set_x (self, x) | |
Keep track of required buffer updates. | |
set_y (self, y) | |
Keep track of required buffer updates. | |
set_z (self, z) | |
Keep track of required buffer updates. | |
set_indices (self, indices) | |
Keep track of required buffer updates. | |
set_colors (self, colors) | |
Keep track of required buffer updates. | |
set_isColorByVertexGroup (self, isColorByVertexGroup) | |
Keep track of required buffer updates. | |
nVertices | getNVertices (self) |
Calculate number of vertices from x, y, and z. | |
prepareToDrawInWindow (self) | |
Create fresh OpenGL buffer objects. | |
draw (self) | |
Draw vertices from OpenGL buffer objects. | |
![]() | |
self | dotsDrawable () |
Constructor takes no arguments. | |
prepareToDrawInWindow (self) | |
Do any pre-draw setup that requires an OpenGL drawing window. | |
mayDrawNow (self) | |
Draw() or not, depending on isVisible and possibly other factors. | |
draw (self) | |
Subclass must redefine draw() to draw graphics. | |
show (self) | |
Shorthand to set isVisible=true. | |
hide (self) | |
Shorthand to set isVisible=false. | |
Protected Methods | |
deleteBuffers (self) | |
Release OpenGL buffer handles and memory. | |
updateBuffers (self) | |
Write attribute, color, and index data to buffers, as needed. | |
deleteAttribBuffer (self) | |
Release OpenGL vertex attribute resources. | |
updateAttribBuffer (self) | |
Write new vertex attributes to OpenGL buffer(s). | |
deleteIndexBuffer (self) | |
Release OpenGL vertex index resources. | |
updateIndexBuffer (self) | |
Write new vertex indices to OpenGL buffer(s). | |
deleteColorBuffer (self) | |
Release OpenGL vertex color resources. | |
updateColorBuffer (self) | |
Write new vertex colors to OpenGL buffer(s). | |
groupIndices | getVertexGroupIndices (self) |
Get an arbitrary 1-based group index for each vertex. | |
buffer | overwriteOrReplaceBuffer (self, oldBuffer, data, target, elementsPerVertex) |
Modify or replace a buffer with new data. | |
selectBuffers (self) | |
Bind buffers for drawing. | |
deselectBuffers (self) | |
Unbind buffers for drawing. | |
flagAllBuffersAsStale (self) | |
Mark all OpenGL buffers as stale. | |
Additional Inherited Members | |
![]() | |
static frameInfo | drawFrame (drawables, doClear) |
draw() several drawable objects and show the next Screen frame. More... | |
static ensemble | makeEnsemble (name, objects) |
Convenient utility for combining a bunch of drawables into an ensemble. More... | |
static frameInfo | drawEnsemble (ensemble, args, prepareFlag, showDuration, pauseDuration) |
Convenient utility for drawing an ensemble either locally or remotely. More... | |
delete | ( | self | ) |
Release OpenGL resources.
Matlab calls delete() automatically when it's done using the object.
Property colors = [1 1 1] |
color map to use for vertices [r g b a; r g b a; etc.
]
Each vertex takes its color from one of the rows of colors. The number of vertices and the number of rows may differ: if there are more vertices than rows, rows are reused in wrapping fashion. If there are more rows than vertices, only the first rows are used.
Property indices = [] |
array of indices for selecting, reusing, and reordering vertices
If indices is empty, vertices are drawn sequentially from elements of x, y, and z. If supplied, vertices are drawn from indexed elements of x, y, and z. This allows arbitrary selection, reuse, and reordering of vertices without changing the underlying buffer objects.
The indices are interpreted as 1-based. The number of indices and the number of vertices may differ. The largest index may not exceed the number of vertices.
Property primitive = 0 |
index to choose OpenGL vertex drawing mode
primitive must be one of the following: 0 GL_POINTS 1 GL_LINE_STRIP 2 GL_LINE_LOOP 3 GL_LINES 4 GL_TRIANGLE_STRIP 5 GL_TRIANGLE_FAN 6 GL_TRIANGLES 7 GL_QUAD_STRIP 8 GL_QUADS 9 GL_POLYGON
Property usageHint = 3 |
index to choose usage "hint" for OpenGL buffers
usageHint must be one of the following: 0 GL_STREAM_DRAW 1 GL_STREAM_READ 2 GL_STREAM_COPY 3 GL_STATIC_DRAW 4 GL_STATIC_READ 5 GL_STATIC_COPY 6 GL_DYNAMIC_DRAW 7 GL_DYNAMIC_READ 8 GL_DYNAMIC_COPY
Property translation = [] |
optional translation to apply to vertex positions [tX tY tZ]
If supplied, vertex x, y, and z positions will be shifted by offsets tX, tY, and tZ. Translation will be applied before rotation and scaling.
Property rotation = [] |
optional rotation of vertices about coordinate axes [rX rY rZ]
If supplied, vertices will be rotated through rX, rY, and rZ degrees (right-handed/counterclockwise) about each coordinate axis, in that order. Rotation will be applied after translation and before scaling.
Property scaling = [] |
optional scaling to apply to vertex positions [sX sY sZ]
If supplied, vertex x, y, and z positions will be scaled by factors sX, sY, and sZ. Scaling will be applied after translation and rotation.