-
-
Save okuoku/7b9f11f7ad236eaba05437e9a9dbb564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Context, Platform */ | |
struct cwgl_ctx_s; | |
typedef struct cwgl_ctx_s cwgl_ctx_t; | |
cwgl_ctx_t* cwgl_ctx_create(int32_t height, int32_t width, int32_t reserved, int32_t flags); | |
void cwgl_ctx_release(cwgl_ctx_t* ctx); | |
#define CWGL_CTX_FLAG_HAS_ALPHA (1<<0) | |
#define CWGL_CTX_FLAG_HAS_DEPTH (1<<1) | |
#define CWGL_CTX_FLAG_HAS_STENCIL (1<<2) | |
#define CWGL_CTX_FLAG_ANTIALIAS (1<<3) | |
#define CWGL_CTX_FLAG_PREMULTIPLIEDALPHA (1<<4) | |
#define CWGL_CTX_FLAG_PRESERVEDRAWINGBUFFER (1<<5) | |
enum cwgl_query_result_e; | |
typedef enum cwgl_query_result_e cwgl_query_result_t; | |
enum cwgl_enum_e; | |
typedef enum cwgl_enum_e cwgl_enum_t; | |
/* Heap Objects */ | |
struct cwgl_string_s; | |
typedef struct cwgl_string_s cwgl_string_t; | |
size_t cwgl_string_size(cwgl_ctx_t* ctx, cwgl_string_t* str); | |
cwgl_query_result_t cwgl_string_read(cwgl_ctx_t* ctx, cwgl_string_t* str, char* buf, size_t buflen); | |
void cwgl_string_release(cwgl_ctx_t* ctx, cwgl_string_t* str); | |
struct cwgl_Buffer_s; | |
struct cwgl_Shader_s; | |
struct cwgl_Program_s; | |
struct cwgl_Texture_s; | |
struct cwgl_Framebuffer_s; | |
struct cwgl_Renderbuffer_s; | |
typedef struct cwgl_Buffer_s cwgl_Buffer_t; | |
typedef struct cwgl_Shader_s cwgl_Shader_t; | |
typedef struct cwgl_Program_s cwgl_Program_t; | |
typedef struct cwgl_Texture_s cwgl_Texture_t; | |
typedef struct cwgl_Framebuffer_s cwgl_Framebuffer_t; | |
typedef struct cwgl_Renderbuffer_s cwgl_Renderbuffer_t; | |
void cwgl_Buffer_release(cwgl_ctx_t* ctx, cwgl_Buffer_t* buffer); | |
void cwgl_Shader_release(cwgl_ctx_t* ctx, cwgl_Shader_t* shader); | |
void cwgl_Program_release(cwgl_ctx_t* ctx, cwgl_Program_t* program); | |
void cwgl_Texture_release(cwgl_ctx_t* ctx, cwgl_Texture_t* texture); | |
void cwgl_Framebuffer_release(cwgl_ctx_t* ctx, cwgl_Framebuffer_t* framebuffer); | |
void cwgl_Renderbuffer_release(cwgl_ctx_t* ctx, cwgl_Renderbuffer_t* renderbuffer); | |
struct cwgl_UniformLocation_s; | |
typedef struct cwgl_UniformLocation_s cwgl_UniformLocation_t; | |
void cwgl_UniformLocation_release(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* uniformlocation); | |
/* Context, Platform */ | |
int32_t cwgl_getContextAttributes(cwgl_ctx_t* ctx); | |
int cwgl_isContextLost(cwgl_ctx_t* ctx); | |
cwgl_query_result_t cwgl_getSupportedExtensions(cwgl_ctx_t* ctx, cwgl_string_t** str, size_t buflen, size_t* out_reslen); | |
//object? getExtension(DOMString name); | |
/* OpenGL State */ | |
void cwgl_disable(cwgl_ctx_t* ctx, cwgl_enum_t cap); | |
void cwgl_enable(cwgl_ctx_t* ctx, cwgl_enum_t cap); | |
// 2.5 GL Errors | |
cwgl_enum_t cwgl_getError(cwgl_ctx_t* ctx); | |
// 2.7 Current Vertex State | |
void cwgl_vertexAttrib1f(cwgl_ctx_t* ctx, uint32_t indx, float x); | |
void cwgl_vertexAttrib2f(cwgl_ctx_t* ctx, uint32_t indx, float x, float y); | |
void cwgl_vertexAttrib3f(cwgl_ctx_t* ctx, uint32_t indx, float x, float y, float z); | |
void cwgl_vertexAttrib4f(cwgl_ctx_t* ctx, uint32_t indx, float x, float y, float z, float w); | |
// 2.8 Vertex Arrays | |
void cwgl_vertexAttribPointer(cwgl_ctx_t* ctx, uint32_t indx, int32_t size, cwgl_enum_t type, int normalized, uint32_t stride, uint32_t offset); | |
void cwgl_enableVertexAttribArray(cwgl_ctx_t* ctx, uint32_t index); | |
void cwgl_disableVertexAttribArray(cwgl_ctx_t* ctx, uint32_t index); | |
void cwgl_drawArrays(cwgl_ctx_t* ctx, cwgl_enum_t mode, int32_t first, uint32_t count); | |
void cwgl_drawElements(cwgl_ctx_t* ctx, cwgl_enum_t mode, uint32_t count, cwgl_enum_t type, uint32_t offset); | |
// 2.9 Buffer Objects | |
void cwgl_bindBuffer(cwgl_ctx_t* ctx, cwgl_enum_t target, cwgl_Buffer_t* buffer); | |
void cwgl_deleteBuffer(cwgl_ctx_t* ctx, cwgl_Buffer_t* buffer); | |
cwgl_Buffer_t* createBuffer(cwgl_ctx_t* ctx); | |
void cwgl_bufferData(cwgl_ctx_t* ctx, cwgl_enum_t target, uint32_t size, void* data, cwgl_enum_t usage); | |
void cwgl_bufferSubData(cwgl_ctx_t* ctx, cwgl_enum_t target, uint32_t offset, void* data, size_t buflen); | |
// 2.10 Vertex shaders | |
// 2.10.1 Loading and Creating Shader Source | |
cwgl_Shader_t* cwgl_createShader(cwgl_ctx_t* ctx, cwgl_enum_t type); | |
void cwgl_shaderSource(cwgl_ctx_t* ctx, const char* source); | |
void cwgl_compileShader(cwgl_ctx_t* ctx, cwgl_Shader_t* shader); | |
void cwgl_deleteShader(cwgl_ctx_t* ctx, cwgl_Shader_t* shader); | |
// 2.10.3 Program Objects | |
cwgl_Program_t* cwgl_createProgram(cwgl_ctx_t* ctx); | |
void cwgl_attachShader(cwgl_ctx_t* ctx, cwgl_Program_t* program, cwgl_Shader_t* shader); | |
void cwgl_detachShader(cwgl_ctx_t* ctx, cwgl_Program_t* program, cwgl_Shader_t* shader); | |
void cwgl_linkProgram(cwgl_ctx_t* ctx, cwgl_Program_t* program); | |
void cwgl_useProgram(cwgl_ctx_t* ctx, cwgl_Program_t* program); | |
void cwgl_deleteProgram(cwgl_ctx_t* ctx, cwgl_Program_t* program); | |
// 2.10.4 Shader Variables | |
cwgl_query_result_t cwgl_getActiveAttrib(cwgl_ctx_t* ctx, cwgl_Program_t* program, int32_t index, int32_t* out_size, int32_t* type, cwgl_string_t** name); | |
int32_t cwgl_getAttribLocation(cwgl_ctx_t* ctx, cwgl_Program_t* program, const char* name); | |
void cwgl_bindAttribLocation(cwgl_ctx_t* ctx, cwgl_Program_t* program, uint32_t index, const char* name); | |
cwgl_UniformLocation_t* cwgl_getUniformLocation(cwgl_ctx_t* ctx, cwgl_Program_t* program, const char* name); | |
cwgl_query_result_t cwgl_getActiveUniform(cwgl_ctx_t* ctx, cwgl_Program_t* program, int32_t index, int32_t* out_size, int32_t* type, cwgl_string_t** name); | |
void cwgl_uniform1f(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, float x); | |
void cwgl_uniform1i(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, int32_t x); | |
void cwgl_uniform2f(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, float x, float y); | |
void cwgl_uniform2i(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, int32_t x, int32_t y); | |
void cwgl_uniform3f(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, float x, float y, float z); | |
void cwgl_uniform3i(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, int32_t x, int32_t y, int32_t z); | |
void cwgl_uniform4f(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, float x, float y, float z, float w); | |
void cwgl_uniform4i(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, int32_t x, int32_t y, int32_t z, int32_t w); | |
void cwgl_uniformMatrix2fv(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, int transpose, float* value); | |
void cwgl_uniformMatrix3fv(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, int transpose, float* value); | |
void cwgl_uniformMatrix4fv(cwgl_ctx_t* ctx, cwgl_UniformLocation_t* location, int transpose, float* value); | |
// 2.10.5 Shader Execution | |
void cwgl_validateProgram(cwgl_ctx_t* ctx, cwgl_Program_t* program); | |
// 2.12.1 Controlling the Viewport | |
void cwgl_depthRange(cwgl_ctx_t* ctx, float zNear, float zFar); | |
void cwgl_viewport(cwgl_ctx_t* ctx, int32_t x, int32_t y, int32_t width, int32_t height); | |
// 3.4 Line Segments | |
void cwgl_linewidth(cwgl_ctx_t* ctx, float width); | |
// 3.5 Polygons | |
void cwgl_frontFace(cwgl_ctx_t* ctx, cwgl_enum_t mode); | |
void cwgl_cullFace(cwgl_ctx_t* ctx, cwgl_enum_t mode); | |
// 3.5.2 Depth offset | |
void cwgl_polygonOffset(cwgl_ctx_t* ctx, float factor, float units); | |
// 3.6.1 Pixel Storage Modes | |
void cwgl_pixelStorei(cwgl_ctx_t* ctx, cwgl_enum_t pname, int32_t param); | |
// 3.7 Texturing | |
void cwgl_activeTexture(cwgl_ctx_t* ctx, cwgl_enum_t texture); | |
// 3.7.1 Texture Image Specification | |
void cwgl_texImage2D(cwgl_ctx_t* ctx, cwgl_enum_t target, int32_t level, cwgl_enum_t internalformat, uint32_t width, uint32_t height, int32_t border, cwgl_enum_t format, cwgl_enum_t type, const void* buf, size_t buflen); | |
// 3.7.2 Alternate Texture Image Specification Commands | |
void cwgl_copyTexImage2D(cwgl_ctx_t* ctx, cwgl_enum_t target, int32_t level, cwgl_enum_t internalformat, int32_t x, int32_t y, uint32_t width, uint32_t height, int32_t border); | |
void cwgl_texSubImage2D(cwgl_ctx_t* ctx, cwgl_enum_t target, int32_t level, int32_t xoffset, int32_t yoffset, uint32_t width, uint32_t height, cwgl_enum_t format, cwgl_enum_t type, const void* buf, size_t buflen); | |
void cwgl_copyTexSubImage2D(cwgl_ctx_t* ctx, cwgl_enum_t target, int32_t level, int32_t xoffset, int32_t yoffset, int32_t x, int32_t y, uint32_t width, uint32_t height); | |
// 3.7.3 Compressed Texture Images | |
void cwgl_compressedTexImage2D(cwgl_ctx_t* ctx, cwgl_enum_t target, int32_t level, cwgl_enum_t internalformat, uint32_t width, uint32_t height, int32_t border, const void* buf, size_t buflen); | |
void cwgl_compressedTexSubImage2D(cwgl_ctx_t* ctx, cwgl_enum_t target, int32_t level, int32_t xoffset, int32_t yoffset, uint32_t width, uint32_t height, cwgl_enum_t format, const void* buf, size_t buflen); | |
// 3.7.4 Texture Parameters | |
void cwgl_texParameterf(cwgl_ctx_t* ctx, cwgl_enum_t target, cwgl_enum_t pname, float param); | |
void cwgl_texParameteri(cwgl_ctx_t* ctx, cwgl_enum_t target, cwgl_enum_t pname, int32_t param); | |
// 3.7.11 Mipmap Generation | |
void cwgl_generateMipmap(cwgl_ctx_t* ctx, cwgl_enum_t target); | |
// 3.7.13 Texture Objects | |
void cwgl_bindTexture(cwgl_ctx_t* ctx, cwgl_enum_t target, cwgl_Texture_t* texture); | |
void cwgl_deleteTexture(cwgl_ctx_t* ctx, cwgl_Texture_t* texture); | |
cwgl_Texture_t* cwgl_createTexture(cwgl_ctx_t* ctx); | |
// 4.1.2 Scissor Test | |
void scissor(GLint x, GLint y, GLsizei width, GLsizei height); | |
// 4.1.3 Multisample Fragment Operations | |
void sampleCoverage(GLclampf value, GLboolean invert); | |
// 4.1.4 Stencil Test | |
void stencilFunc(GLenum func, GLint ref, GLuint mask); | |
void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); | |
void stencilOp(GLenum fail, GLenum zfail, GLenum zpass); | |
void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); | |
// 4.1.5 Depth Buffer Test | |
void depthFunc(GLenum func); | |
// 4.1.6 Blending | |
void blendEquation(GLenum mode); | |
void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); | |
void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); | |
void blendFunc(GLenum sfactor, GLenum dfactor); | |
void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); | |
// 4.2.2 Fine Control of Buffer Updates | |
void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); | |
void depthMask(GLboolean flag); | |
void stencilMask(GLuint mask); | |
void stencilMaskSeparate(GLenum face, GLuint mask); | |
// 4.2.3 Clearing the Buffers | |
void clear(GLbitfield mask); | |
void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); | |
void clearDepth(GLclampf depth); | |
void clearStencil(GLint s); | |
// 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 renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); | |
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 | |
GLenum checkFramebufferStatus(GLenum target); | |
// 5.1 Flush and Finish | |
void finish(); | |
void flush(); | |
// 5.2 Hints | |
void hint(GLenum target, GLenum mode); | |
// 6.1.1 Simple Queries | |
any getParameter(GLenum pname); // GetBooleanv / GetIntegerv / GetFloatv | |
GLboolean isEnabled(GLenum cap); | |
// 6.1.3 Enumerated Queries | |
any getTexParameter(GLenum target, GLenum pname); | |
any getBufferParameter(GLenum target, GLenum pname); | |
any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname); | |
any getRenderbufferParameter(GLenum target, GLenum pname); | |
// 6.1.4 Texture Queries | |
GLboolean isTexture(WebGLTexture? texture); // how's non-bound textures? | |
// 6.1.5 String Queries | |
// GetString => getParameter | |
// 6.1.6 Buffer Object Queries | |
GLboolean isBuffer(WebGLBuffer? buffer); | |
// 6.1.7 Framebuffer Object and Renderbuffer Queries | |
GLboolean isFramebuffer(WebGLFramebuffer? framebuffer); | |
GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer); | |
// 6.1.8 Shader and Program Queries | |
GLboolean isShader(WebGLShader? shader); | |
any getShaderParameter(WebGLShader? shader, GLenum pname); // GetShaderiv | |
GLboolean isProgram(WebGLProgram? program); | |
any getProgramParameter(WebGLProgram? program, GLenum pname); // GetProgramiv | |
sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program); | |
DOMString? getProgramInfoLog(WebGLProgram? program); | |
DOMString? getShaderInfoLog(WebGLShader? shader); | |
DOMString? getShaderSource(WebGLShader? shader); | |
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); | |
any getVertexAttrib(GLuint index, GLenum pname); | |
GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname); // GetVertexAttribPointer | |
any getUniform(WebGLProgram? program, WebGLUniformLocation? location); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment