Skip to content

Instantly share code, notes, and snippets.

@okuoku
Last active Dec 16, 2020
Embed
What would you like to do?
/* Context, Platform */
WebGLContextAttributes? getContextAttributes();
object? getExtension(DOMString name);
/* OpenGL State */
// 2.5 GL Errors
// 2.7 Current Vertex State
// 2.8 Vertex Arrays
// 2.9 Buffer Objects
void bindBuffer(GLenum target, WebGLBuffer? buffer);
void deleteBuffer(WebGLBuffer? buffer);
WebGLBuffer? createBuffer(); // genBuffers
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data);
// 2.10 Vertex shaders
// 2.12.1 Controlling the Viewport
// 3.4 Line Segments
// 3.5 Polygons
// 3.5.2 Depth offset
// 3.6.1 Pixel Storage Modes
// 3.7 Texturing
// 3.7.1 Texture Image Specification
void texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView? pixels);
void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, TexImageSource? source); // May throw DOMException
// 3.7.2 Alternate Texture Image Specification Commands
void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView? pixels);
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, TexImageSource? source); // May throw DOMException
void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
// 3.7.3 Compressed Texture Images
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, ArrayBufferView data);
void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, ArrayBufferView data);
// 3.7.4 Texture Parameters
// 3.7.11 Mipmap Generation
// 3.7.13 Texture Objects
void bindTexture(GLenum target, WebGLTexture? texture);
void deleteTexture(WebGLTexture? texture);
WebGLTexture? createTexture(); // GenTextures
// 4.1.2 Scissor Test
// 4.1.3 Multisample Fragment Operations
// 4.1.4 Stencil Test
// 4.1.5 Depth Buffer Test
// 4.1.6 Blending
// 4.2.2 Fine Control of Buffer Updates
// 4.2.3 Clearing the Buffers
// 4.3.1 Reading Pixels
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView? pixels);
// 4.4.1 Binding and Managing Framebuffer Objects
void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
void deleteFramebuffer(WebGLFramebuffer? framebuffer);
WebGLFramebuffer? createFramebuffer(); // genFramebuffers
// 4.4.3 Renderbuffer Objects
void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer);
WebGLRenderbuffer? createRenderbuffer(); // genRenderBuffers
void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer? renderbuffer);
void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, WebGLTexture? texture, GLint level);
// 4.4.5 Framebuffer Completeness
// 5.1 Flush and Finish
// 5.2 Hints
// 6.1.5 String Queries
// GetString => getParameter
// 2.10.1 Loading and Creating Shader Source
// missing: ReleaseShaderCompiler
WebGLShader? createShader(GLenum type);
void shaderSource(WebGLShader? shader, DOMString source);
void compileShader(WebGLShader? shader);
void deleteShader(WebGLShader? shader);
// 2.10.3 Program Objects
WebGLProgram? createProgram();
void attachShader(WebGLProgram? program, WebGLShader? shader);
void detachShader(WebGLProgram? program, WebGLShader? shader);
void linkProgram(WebGLProgram? program);
void useProgram(WebGLProgram? program);
void deleteProgram(WebGLProgram? program);
// 2.10.4 Shader Variables
WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint index);
GLint getAttribLocation(WebGLProgram? program, DOMString name);
void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
// 2.10.5 Shader Execution
void validateProgram(WebGLProgram? program);
// 6.1.8 Shader and Program Queries
sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname); // GetVertexAttribPointer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment