Previous: glDispatchComputeIndirect Table of Contents (GL) Next: glDrawArraysIndirect

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.

See Also

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 tests/line_stipple.py Lines: 36
OpenGLContext tests/shader_spike.py Lines: 88
OpenGLContext tests/gldrawarrays.py Lines: 20
OpenGLContext tests/shader_2_c_void_p.py Lines: 64
OpenGLContext tests/gldrawarrays_string.py Lines: 18
OpenGLContext tests/shader_2.py Lines: 184
OpenGLContext tests/shader_4.py Lines: 161
OpenGLContext tests/shader_5.py Lines: 314
OpenGLContext tests/shader_1.py Lines: 267
OpenGLContext tests/shader_3.py Lines: 171
OpenGLContext tests/pygame_textureatlas.py Lines: 147
OpenGLContext OpenGLContext/drawcube.py Lines: 37, 52
OpenGLContext OpenGLContext/shadow/volume.py Lines: 297, 307
OpenGLContext OpenGLContext/scenegraph/pointset.py Lines: 79
OpenGLContext OpenGLContext/scenegraph/shaders.py Lines: 605, 611
OpenGLContext OpenGLContext/scenegraph/box.py Lines: 44, 55
OpenGLContext OpenGLContext/scenegraph/text/toolsfont.py Lines: 31, 165
OpenGL-Demo PyOpenGL-Demo/da/dots.py Lines: 59
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/arraytest.py Lines: 50
OpenGL-Demo PyOpenGL-Demo/tom/arraytest.py Lines: 32
OpenGL-Demo PyOpenGL-Demo/tom/poly.py Lines: 45
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson45.py Lines: 454
{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 core/line.py Lines: 690, 754, 770, 775, 790, 795, 835, 846
Visvis core/axises.py Lines: 793, 807, 838, 2020, 2027
Visvis core/baseWibjects.py Lines: 199
Visvis functions/boxplot.py Lines: 326
Visvis functions/bar.py Lines: 142, 149
Visvis text/text_base.py Lines: 261
Visvis wobjects/textures.py Lines: 960
Visvis wobjects/polygonalModeling.py Lines: 1049
Visvis wibjects/sliders.py Lines: 352, 355, 412
Visvis wibjects/colorWibjects.py Lines: 543, 549, 554, 757
Previous: glDispatchComputeIndirect Table of Contents (GL) Next: glDrawArraysIndirect