/* File: cwasm_webgl_js_imports.h Author: Taylor Robbins Date: 09\01\2025 */ #ifndef _CWASM_WEBGL_JS_IMPORTS_H #define _CWASM_WEBGL_JS_IMPORTS_H typedef int GlId; // Really this is just an index into a javascript array that holds the real reference to the WebGL object typedef int GlEnum; MAYBE_EXTERN_C GlId jsGlCreateBuffer(); MAYBE_EXTERN_C void jsGlBindBuffer(GlEnum bufferType, GlId bufferId); MAYBE_EXTERN_C void jsGlBufferData(GlEnum bufferType, u32 dataLength, const void* dataPntr, GlEnum usageHint); MAYBE_EXTERN_C GlId jsGlCreateVertexArray(); MAYBE_EXTERN_C void jsGlBindVertexArray(GlId vaoId); MAYBE_EXTERN_C void jsGlEnableVertexAttribArray(GlEnum location); MAYBE_EXTERN_C void jsGlVertexAttribPointer(GlEnum attribLocation, int componentCount, GlEnum componentType, bool normalized, int stride, int offset); MAYBE_EXTERN_C GlId jsGlCreateShader(GlEnum shaderType); MAYBE_EXTERN_C void jsGlShaderSource(GlId shaderId, int sourceLength, const char* sourcePntr); MAYBE_EXTERN_C void jsGlCompileShader(GlId shaderId); MAYBE_EXTERN_C bool jsGlGetShaderParameterBool(GlId shaderId, GlEnum parameter); MAYBE_EXTERN_C int jsGlGetShaderParameterInt(GlId shaderId, GlEnum parameter); MAYBE_EXTERN_C GlId jsGlCreateProgram(); MAYBE_EXTERN_C void jsGlAttachShader(GlId programId, GlId shaderId); MAYBE_EXTERN_C void jsGlLinkProgram(GlId programId); MAYBE_EXTERN_C void jsGlUseProgram(GlId programId); MAYBE_EXTERN_C bool jsGlGetProgramParameterBool(GlId programId, GlEnum parameter); MAYBE_EXTERN_C int jsGlGetProgramParameterInt(GlId programId, GlEnum parameter); MAYBE_EXTERN_C void jsGlClearColor(r32 rValue, r32 gValue, r32 bValue, r32 aValue); MAYBE_EXTERN_C void jsGlClear(int bufferBits); MAYBE_EXTERN_C void jsGlDrawArrays(GlEnum geometryType, int startIndex, int count); #endif // _CWASM_WEBGL_JS_IMPORTS_H