glDrawArrays

render primitives from array data

Signature

glDrawArrays( GLenum ( mode ) , GLint ( first ) , GLsizei ( count ) )-> void
glDrawArrays( mode , first , count )

Parameters

VariablesDescription
mode
Specifies what kind of primitives to render. Symbolic constants GL_POINTS , GL_LINE_STRIP , GL_LINE_LOOP , GL_LINES , GL_LINE_STRIP_ADJACENCY , GL_LINES_ADJACENCY , GL_TRIANGLE_STRIP , GL_TRIANGLE_FAN , GL_TRIANGLES , GL_TRIANGLE_STRIP_ADJACENCY , GL_TRIANGLES_ADJACENCY and GL_PATCHES are accepted.
first
Specifies the starting index in the enabled arrays.
count
Specifies the number of indices to be rendered.

Description

glDrawArrays specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertices, normals, and colors and use them to construct a sequence of primitives with a single call to glDrawArrays .
When glDrawArrays is called, it uses count sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element first . mode specifies what kind of primitives are constructed and how the array elements construct those primitives.
Vertex attributes that are modified by glDrawArrays have an unspecified value after glDrawArrays returns. Attributes that aren't modified remain well defined.

Notes

GL_LINE_STRIP_ADJACENCY , GL_LINES_ADJACENCY , GL_TRIANGLE_STRIP_ADJACENCY and GL_TRIANGLES_ADJACENCY are available only if the GL version is 3.2 or greater.

Errors

GL_INVALID_ENUM is generated if mode is not an accepted value.
GL_INVALID_VALUE is generated if count is negative.
GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array and the buffer object's data store is currently mapped.
GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object.

Version Support

glDrawArrays

See Also

Copyright

Copyright
1991-2006 Silicon Graphics, Inc. Copyright
2010-2014 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see .

Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glDrawArrays
OpenGLContext OpenGLContext/drawcube.py Lines: 37, 52
OpenGLContext OpenGLContext/scenegraph/shaders.py Lines: 645, 651
OpenGLContext OpenGLContext/scenegraph/box.py Lines: 44, 55
OpenGLContext OpenGLContext/scenegraph/pointset.py Lines: 79
OpenGLContext OpenGLContext/scenegraph/text/toolsfont.py Lines: 31, 169
OpenGLContext OpenGLContext/shadow/volume.py Lines: 297, 307
OpenGLContext tests/shader_3.py Lines: 171
OpenGLContext tests/gldrawarrays.py Lines: 19
OpenGLContext tests/shader_2.py Lines: 185
OpenGLContext tests/pygame_textureatlas.py Lines: 147
OpenGLContext tests/shader_4.py Lines: 161
OpenGLContext tests/shader_2_c_void_p.py Lines: 64
OpenGLContext tests/line_stipple.py Lines: 35
OpenGLContext tests/gldrawarrays_string.py Lines: 19
OpenGLContext tests/shader_5.py Lines: 315
OpenGLContext tests/shader_4_subset.py Lines: 72
OpenGLContext tests/shader_spike.py Lines: 88
OpenGLContext tests/shader_1.py Lines: 267
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson45.py Lines: 439
OpenGL-Demo PyOpenGL-Demo/da/dots.py Lines: 59
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/arraytest.py Lines: 46
OpenGL-Demo PyOpenGL-Demo/tom/poly.py Lines: 42
OpenGL-Demo PyOpenGL-Demo/tom/arraytest.py Lines: 30
{LGPL} PyMT pymt/obj.py Lines: 20, 113
{LGPL} Pyggel pyggel/data.py Lines: 260, 385
OpenGL Tutorial (Python Translation) t02.playing-with-colors/FragPosition.py Lines: 90
OpenGL Tutorial (Python Translation) t02.playing-with-colors/VertexColors.py Lines: 95
OpenGL Tutorial (Python Translation) t01.hello-triangle/HelloTriangle.py Lines: 104
Visvis wobjects/polygonalModeling.py Lines: 1054
Visvis wobjects/textures.py Lines: 963
Visvis text/text_base.py Lines: 262
Visvis functions/boxplot.py Lines: 333
Visvis functions/bar.py Lines: 168, 175
Visvis wibjects/sliders.py Lines: 400, 403, 461
Visvis wibjects/colorWibjects.py Lines: 543, 549, 554, 757
Visvis core/line.py Lines: 693, 759, 775, 780, 795, 800, 840, 851
Visvis core/baseWibjects.py Lines: 199
Visvis core/axises.py Lines: 793, 807, 838, 2020, 2027