Function Reference

All functions are declared in include/metagl/Functions.hpp and live in the metagl namespace. Each maps directly to one underlying gl* OpenGL ES call. Numbers (#1, #2 …) correspond to the internal ordering in the source file. ES version tags show the minimum required version.

State Management (#1 – #51)

Capabilities

void glEnable(Capability cap);                          // #1 ES2+
void glDisable(Capability cap);                         // #2 ES2+
void glEnablei(Capability target, GLuint index);       // #3 ES3.2
void glDisablei(Capability target, GLuint index);      // #4 ES3.2
GLboolean glIsEnabled(Capability cap);                 // #5 ES2+
GLboolean glIsEnabledi(Capability target, GLuint i);  // #6 ES3.2

Blending

void glBlendFunc(BlendFactor sfactor, BlendFactor dfactor);              // #7
void glBlendFuncSeparate(BlendFactor sRGB, BlendFactor dRGB,
                          BlendFactor sA, BlendFactor dA);              // #8
void glBlendFunci(GLuint buf, BlendFactor src, BlendFactor dst);         // #9  ES3.2
void glBlendFuncSeparatei(GLuint buf, ...);                               // #10 ES3.2
void glBlendEquation(BlendEquation mode);                                 // #11
void glBlendEquationSeparate(BlendEquation mRGB, BlendEquation mA);       // #12
void glBlendEquationi(GLuint buf, BlendEquation mode);                    // #13 ES3.2
void glBlendEquationSeparatei(GLuint buf, ...);                            // #14 ES3.2
void glBlendColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a);            // #15
void glBlendBarrier(void);                                                 // #16 ES3.2

Depth & Stencil

void glDepthFunc(CompareFunc func);                                       // #19
void glDepthMask(GLboolean flag);                                          // #20
void glDepthRangef(GLfloat n, GLfloat f);                                  // #21
void glStencilFunc(CompareFunc func, GLint ref, GLuint mask);             // #22
void glStencilFuncSeparate(CullFace face, CompareFunc func, ...);          // #23
void glStencilOp(StencilOp fail, StencilOp zfail, StencilOp zpass);       // #24
void glStencilOpSeparate(CullFace face, StencilOp sf, StencilOp dp, StencilOp zp); // #25
void glStencilMask(GLuint mask);                                            // #26
void glStencilMaskSeparate(CullFace face, GLuint mask);                    // #27

Viewport, Scissor & Raster

void glScissor(GLint x, GLint y, GLsizei w, GLsizei h);                   // #28
void glViewport(GLint x, GLint y, GLsizei w, GLsizei h);                  // #29
void glCullFace(CullFace mode);                                             // #30
void glFrontFace(FrontFace mode);                                           // #31
void glLineWidth(GLfloat width);                                             // #32
void glPolygonOffset(GLfloat factor, GLfloat units);                        // #33
void glSampleCoverage(GLfloat value, GLboolean invert);                    // #34
void glSampleMaski(GLuint maskNumber, GLbitfield mask);                     // #35 ES3.1
void glMinSampleShading(GLfloat value);                                     // #36 ES3.2
void glHint(HintTarget target, HintMode mode);                             // #37
void glPixelStorei(PixelStoreParam pname, GLint param);                    // #38

Flush, Errors & State Query

void       glFinish(void);                                                  // #39
void       glFlush(void);                                                   // #40
ErrorCode  glGetError(void);                                                // #41
void       glGetBooleanv(GetParameter pname, GLboolean* data);             // #42
void       glGetIntegerv(GetParameter pname, GLint* data);                 // #43
void       glGetFloatv(GetParameter pname, GLfloat* data);                 // #44
void       glGetInteger64v(GetParameter pname, GLint64* data);             // #45 ES3+
const GLubyte* glGetString(StringName name);                               // #49
const GLubyte* glGetStringi(StringName name, GLuint index);               // #50 ES3+

Buffer Objects (#52 – #66)

void      glGenBuffers(GLsizei n, GLuint* buffers);                        // #52
void      glDeleteBuffers(GLsizei n, const GLuint* buffers);               // #53
void      glBindBuffer(BufferTarget target, GLuint buffer);               // #54
void      glBindBufferBase(BufferTarget target, GLuint index, GLuint buf); // #55 ES3+
void      glBindBufferRange(BufferTarget, GLuint idx, GLuint buf,
                             GLintptr offset, GLsizeiptr size);             // #56 ES3+
void      glBufferData(BufferTarget target, GLsizeiptr size,
                        const void* data, BufferUsage usage);              // #57
void      glBufferSubData(BufferTarget, GLintptr offset,
                           GLsizeiptr size, const void* data);             // #58
void      glCopyBufferSubData(BufferTarget read, BufferTarget write,
                               GLintptr rOff, GLintptr wOff, GLsizeiptr);  // #59 ES3+
void*     glMapBufferRange(BufferTarget, GLintptr offset,
                            GLsizeiptr length, MapBufferAccessMask);       // #60 ES3+
void      glFlushMappedBufferRange(BufferTarget, GLintptr, GLsizeiptr);   // #61 ES3+
GLboolean glUnmapBuffer(BufferTarget target);                              // #62 ES3+
GLboolean glIsBuffer(GLuint buffer);                                       // #63

Vertex Arrays (#67 – #97)

void      glGenVertexArrays(GLsizei n, GLuint* arrays);                    // #67 ES3+
void      glDeleteVertexArrays(GLsizei n, const GLuint*);                 // #68 ES3+
void      glBindVertexArray(GLuint array);                                  // #69 ES3+
void      glEnableVertexAttribArray(GLuint index);                          // #71
void      glDisableVertexAttribArray(GLuint index);                         // #72
void      glVertexAttribPointer(GLuint idx, GLint size,
                                  DataType type, GLboolean norm,
                                  GLsizei stride, const void* ptr);        // #73
void      glVertexAttribIPointer(GLuint idx, GLint size, DataType type,
                                   GLsizei stride, const void* ptr);        // #74 ES3+
void      glVertexAttribDivisor(GLuint index, GLuint divisor);             // #75 ES3+
// Constant attribute setters: glVertexAttrib1f/2f/3f/4f + array variants     #76–#87
// ES 3.1 vertex buffer binding API:                                           #93–#97
void      glVertexAttribFormat(GLuint idx, GLint sz, DataType, GLboolean, GLuint);
void      glBindVertexBuffer(GLuint bindidx, GLuint buf, GLintptr, GLsizei);

Drawing (#98 – #119)

// Non-indexed
void glDrawArrays(PrimitiveType mode, GLint first, GLsizei count);          // #98
void glDrawArraysInstanced(PrimitiveType, GLint, GLsizei, GLsizei);         // #99  ES3+
void glDrawArraysIndirect(PrimitiveType, const void*);                       // #100 ES3.1
// Indexed
void glDrawElements(PrimitiveType, GLsizei, DataType, const void*);         // #101
void glDrawElementsInstanced(...);                                              // #102 ES3+
void glDrawRangeElements(...);                                                   // #103 ES3+
void glDrawElementsBaseVertex(PrimitiveType, GLsizei, DataType,
                               const void*, GLint basevertex);               // #104 ES3.2
void glDrawElementsIndirect(PrimitiveType, DataType, const void*);           // #107 ES3.1
// Read / Clear
void glReadPixels(GLint x, GLint y, GLsizei w, GLsizei h,
                   PixelFormat, PixelType, void*);                           // #110
void glClear(ClearBufferBit mask);                                             // #112
void glClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a);              // #113
void glClearDepthf(GLfloat d);                                                 // #114
void glClearStencil(GLint s);                                                  // #115
// ES3+ typed clears: glClearBufferfv/iv/uiv/fi                                 #116–#119

Shaders & Programs (#120 – #153)

GLuint glCreateShader(ShaderType type);                                      // #120
void   glDeleteShader(GLuint shader);                                         // #121
void   glShaderSource(GLuint shader, GLsizei count,
                        const GLchar*const*, const GLint*);                  // #122
void   glCompileShader(GLuint shader);                                        // #123
void   glGetShaderiv(GLuint shader, ShaderParameter pname, GLint*);         // #126
void   glGetShaderInfoLog(GLuint, GLsizei, GLsizei*, GLchar*);              // #127
GLuint glCreateProgram(void);                                                  // #131
void   glDeleteProgram(GLuint program);                                        // #132
void   glAttachShader(GLuint program, GLuint shader);                         // #133
void   glDetachShader(GLuint program, GLuint shader);                         // #134
void   glLinkProgram(GLuint program);                                          // #135
void   glUseProgram(GLuint program);                                           // #136
void   glGetProgramiv(GLuint program, ProgramParameter pname, GLint*);      // #138
void   glGetProgramInfoLog(GLuint, GLsizei, GLsizei*, GLchar*);            // #139
GLint  glGetAttribLocation(GLuint program, const GLchar* name);              // #143

Uniforms (#154 – #230)

GLint glGetUniformLocation(GLuint program, const GLchar* name);             // #154
void  glUniform1f(GLint loc, GLfloat v0);                                    // #162
void  glUniform2f(GLint loc, GLfloat v0, GLfloat v1);                        // #163
void  glUniform3f(GLint loc, GLfloat v0, GLfloat v1, GLfloat v2);           // #164
void  glUniform4f(GLint loc, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); // #165
void  glUniform1i(GLint loc, GLint v0);                                       // #166
void  glUniform2i / 3i / 4i (...);                                               // #167–#169
void  glUniform1fv / 2fv / 3fv / 4fv (...);                                     // float array variants
void  glUniform1iv / 2iv / 3iv / 4iv (...);                                     // int array variants
void  glUniformMatrix2fv / 3fv / 4fv(GLint loc, GLsizei count,
                                        GLboolean transpose, const GLfloat*); // matrices
void  glUniformBlockBinding(GLuint prog, GLuint blockIdx, GLuint binding);   // #161 ES3+

Textures (#231 – #310)

void      glGenTextures(GLsizei n, GLuint* textures);
void      glDeleteTextures(GLsizei n, const GLuint*);
void      glBindTexture(TextureTarget target, GLuint texture);
void      glActiveTexture(TextureUnit texture);
void      glTexImage2D(TextureTarget, GLint level, InternalFormat,
                         GLsizei w, GLsizei h, GLint border,
                         PixelFormat, PixelType, const void*);
void      glTexSubImage2D(...);
void      glTexImage3D(...);                                                   // ES3+
void      glTexStorage2D(TextureTarget, GLsizei levels,
                           InternalFormat, GLsizei w, GLsizei h);             // ES3+
void      glTexStorage3D(...);                                                  // ES3+
void      glTexParameteri(TextureTarget, TextureParameter, GLint);
void      glTexParameterf(TextureTarget, TextureParameter, GLfloat);
void      glGenerateMipmap(TextureTarget target);
void      glCompressedTexImage2D(TextureTarget, GLint level,
                                   CompressedInternalFormat, GLsizei w,
                                   GLsizei h, GLint border, GLsizei size,
                                   const void* data);

Framebuffers & Renderbuffers (#311 – #360)

void           glGenFramebuffers(GLsizei n, GLuint*);
void           glDeleteFramebuffers(GLsizei n, const GLuint*);
void           glBindFramebuffer(FramebufferTarget, GLuint);
FramebufferStatus glCheckFramebufferStatus(FramebufferTarget);
void           glFramebufferTexture2D(FramebufferTarget, FramebufferAttachment,
                                       TextureTarget, GLuint, GLint level);
void           glFramebufferRenderbuffer(FramebufferTarget,
                                         FramebufferAttachment,
                                         RenderbufferTarget, GLuint);
void           glGenRenderbuffers(GLsizei n, GLuint*);
void           glDeleteRenderbuffers(GLsizei n, const GLuint*);
void           glBindRenderbuffer(RenderbufferTarget, GLuint);
void           glRenderbufferStorage(RenderbufferTarget, InternalFormat,
                                      GLsizei w, GLsizei h);
void           glRenderbufferStorageMultisample(...);                           // ES3+
void           glBlitFramebuffer(GLint sX0,GLint sY0,GLint sX1,GLint sY1,
                                   GLint dX0,GLint dY0,GLint dX1,GLint dY1,
                                   ClearBufferBit, TextureFilter);            // ES3+

Queries & GPU Sync (#361 – #390)

// Occlusion & primitives queries (ES3+)
void      glGenQueries(GLsizei n, GLuint* ids);
void      glDeleteQueries(GLsizei n, const GLuint*);
void      glBeginQuery(QueryTarget, GLuint id);
void      glEndQuery(QueryTarget);
void      glGetQueryObjectuiv(GLuint id, QueryObjectParameter, GLuint*);
// Fence sync (ES3+)
GLsync    glFenceSync(SyncCondition, GLbitfield flags);
void      glDeleteSync(GLsync);
SyncWaitResult glClientWaitSync(GLsync, SyncFlushMask, GLuint64 timeout);
void      glWaitSync(GLsync, GLbitfield, GLuint64);

Compute Shaders (#391 – #400, ES 3.1+)

void glDispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ);
void glDispatchComputeIndirect(GLintptr indirect);
void glMemoryBarrier(MemoryBarrierMask barriers);
void glMemoryBarrierByRegion(MemoryBarrierMask barriers);
void glBindImageTexture(GLuint unit, GLuint texture, GLint level,
                          GLboolean layered, GLint layer,
                          ImageAccess access, InternalFormat format);

Debug Callbacks (ES 3.2+)

void glDebugMessageCallback(GLDEBUGPROC callback, const void* userParam);
void glDebugMessageControl(DebugSource, DebugType, DebugSeverity,
                             GLsizei count, const GLuint* ids,
                             GLboolean enabled);
void glDebugMessageInsert(DebugSource, DebugType, GLuint id,
                            DebugSeverity, GLsizei length,
                            const GLchar* message);
void glObjectLabel(DebugObjectLabel identifier, GLuint name,
                     GLsizei length, const GLchar* label);
void glPushDebugGroup(DebugSource, GLuint id, GLsizei, const GLchar*);
void glPopDebugGroup(void);

Transform Feedback (ES 3.0+)

void glGenTransformFeedbacks(GLsizei n, GLuint*);
void glDeleteTransformFeedbacks(GLsizei n, const GLuint*);
void glBindTransformFeedback(TransformFeedbackTarget, GLuint);
void glBeginTransformFeedback(PrimitiveType primitiveMode);
void glEndTransformFeedback(void);
void glPauseTransformFeedback(void);
void glResumeTransformFeedback(void);
void glTransformFeedbackVaryings(GLuint program, GLsizei count,
                                   const GLchar*const* varyings,
                                   TransformFeedbackBufferMode);
void glDrawTransformFeedback(PrimitiveType, GLuint id);                      // ES3.2