83 lines
4.3 KiB
Plaintext
83 lines
4.3 KiB
Plaintext
// The subset of OpenGL (ES 3.0 / WebGL2) that the renderer uses, declared with the same names and
|
|
// signatures as the native GL module. Each call is a WASM import implemented as a one-liner in web/taskforge.js,
|
|
// so render.jai is the same code on both platforms.
|
|
|
|
GLenum :: u32;
|
|
GLuint :: u32;
|
|
GLint :: s32;
|
|
GLsizei :: u32;
|
|
GLboolean :: u8;
|
|
GLbitfield :: u32;
|
|
GLfloat :: float;
|
|
GLchar :: u8;
|
|
GLsizeiptr :: s64;
|
|
|
|
GL_FALSE :: 0;
|
|
GL_TRUE :: 1;
|
|
GL_TRIANGLES :: 0x0004;
|
|
GL_SRC_ALPHA :: 0x0302;
|
|
GL_ONE_MINUS_SRC_ALPHA :: 0x0303;
|
|
GL_CULL_FACE :: 0x0B44;
|
|
GL_DEPTH_TEST :: 0x0B71;
|
|
GL_BLEND :: 0x0BE2;
|
|
GL_SCISSOR_TEST :: 0x0C11;
|
|
GL_UNPACK_ALIGNMENT :: 0x0CF5;
|
|
GL_TEXTURE_2D :: 0x0DE1;
|
|
GL_UNSIGNED_BYTE :: 0x1401;
|
|
GL_FLOAT :: 0x1406;
|
|
GL_RED :: 0x1903;
|
|
GL_LINEAR :: 0x2601;
|
|
GL_TEXTURE_MAG_FILTER :: 0x2800;
|
|
GL_TEXTURE_MIN_FILTER :: 0x2801;
|
|
GL_TEXTURE_WRAP_S :: 0x2802;
|
|
GL_TEXTURE_WRAP_T :: 0x2803;
|
|
GL_COLOR_BUFFER_BIT :: 0x4000;
|
|
GL_CLAMP_TO_EDGE :: 0x812F;
|
|
GL_R8 :: 0x8229;
|
|
GL_TEXTURE0 :: 0x84C0;
|
|
GL_ARRAY_BUFFER :: 0x8892;
|
|
GL_STREAM_DRAW :: 0x88E0;
|
|
GL_FRAGMENT_SHADER :: 0x8B30;
|
|
GL_VERTEX_SHADER :: 0x8B31;
|
|
GL_COMPILE_STATUS :: 0x8B81;
|
|
GL_LINK_STATUS :: 0x8B82;
|
|
GL_INFO_LOG_LENGTH :: 0x8B84;
|
|
|
|
glCreateShader :: (type: GLenum) -> GLuint #foreign;
|
|
glShaderSource :: (shader: GLuint, count: GLsizei, strings: **GLchar, lengths: *GLint) #foreign;
|
|
glCompileShader :: (shader: GLuint) #foreign;
|
|
glGetShaderiv :: (shader: GLuint, pname: GLenum, params: *GLint) #foreign;
|
|
glGetShaderInfoLog :: (shader: GLuint, max_length: GLsizei, length: *GLsizei, info_log: *GLchar) #foreign;
|
|
glCreateProgram :: () -> GLuint #foreign;
|
|
glAttachShader :: (program: GLuint, shader: GLuint) #foreign;
|
|
glBindAttribLocation :: (program: GLuint, index: GLuint, name: *GLchar) #foreign;
|
|
glLinkProgram :: (program: GLuint) #foreign;
|
|
glGetProgramiv :: (program: GLuint, pname: GLenum, params: *GLint) #foreign;
|
|
glGetProgramInfoLog :: (program: GLuint, max_length: GLsizei, length: *GLsizei, info_log: *GLchar) #foreign;
|
|
glUseProgram :: (program: GLuint) #foreign;
|
|
glGetUniformLocation :: (program: GLuint, name: *GLchar) -> GLint #foreign;
|
|
glUniform1i :: (location: GLint, v0: GLint) #foreign;
|
|
glUniform1f :: (location: GLint, v0: GLfloat) #foreign;
|
|
glUniform2f :: (location: GLint, v0: GLfloat, v1: GLfloat) #foreign;
|
|
glGenVertexArrays :: (n: GLsizei, arrays: *GLuint) #foreign;
|
|
glBindVertexArray :: (array: GLuint) #foreign;
|
|
glGenBuffers :: (n: GLsizei, buffers: *GLuint) #foreign;
|
|
glBindBuffer :: (target: GLenum, buffer: GLuint) #foreign;
|
|
glBufferData :: (target: GLenum, size: GLsizeiptr, data: *void, usage: GLenum) #foreign;
|
|
glVertexAttribPointer :: (index: GLuint, size: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, pointer: *void) #foreign;
|
|
glEnableVertexAttribArray :: (index: GLuint) #foreign;
|
|
glGenTextures :: (n: GLsizei, textures: *GLuint) #foreign;
|
|
glBindTexture :: (target: GLenum, texture: GLuint) #foreign;
|
|
glActiveTexture :: (texture: GLenum) #foreign;
|
|
glTexImage2D :: (target: GLenum, level: GLint, internal_format: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: *void) #foreign;
|
|
glTexParameteri :: (target: GLenum, pname: GLenum, param: GLint) #foreign;
|
|
glPixelStorei :: (pname: GLenum, param: GLint) #foreign;
|
|
glEnable :: (cap: GLenum) #foreign;
|
|
glDisable :: (cap: GLenum) #foreign;
|
|
glBlendFunc :: (sfactor: GLenum, dfactor: GLenum) #foreign;
|
|
glScissor :: (x: GLint, y: GLint, width: GLsizei, height: GLsizei) #foreign;
|
|
glViewport :: (x: GLint, y: GLint, width: GLsizei, height: GLsizei) #foreign;
|
|
glClearColor :: (r: GLfloat, g: GLfloat, b: GLfloat, a: GLfloat) #foreign;
|
|
glClear :: (mask: GLbitfield) #foreign;
|
|
glDrawArrays :: (mode: GLenum, first: GLint, count: GLsizei) #foreign;
|