Added some more WebGL functions to gl_functions.js. Made the test_app render something more interesting. Added a bool return from App_UpdateAndRender which allows it to request that the application loop ends.

This commit is contained in:
2025-09-01 19:21:47 -07:00
parent 42cf6d9e9f
commit 81f5457b61
5 changed files with 150 additions and 29 deletions

View File

@@ -10,6 +10,13 @@ Date: 09\01\2025
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 void jsGlEnable(GlEnum capability);
MAYBE_EXTERN_C void jsGlDisable(GlEnum capability);
MAYBE_EXTERN_C void jsGlBlendFunc(GlEnum srcFactor, GlEnum dstFactor);
MAYBE_EXTERN_C void jsGlBlendFuncSeparate(GlEnum srcRGB, GlEnum dstRGB, GlEnum srcAlpha, GlEnum dstAlpha);
MAYBE_EXTERN_C void jsGlDepthFunc(GlEnum depthFunc);
MAYBE_EXTERN_C void jsGlFrontFace(GlEnum cullMode);
MAYBE_EXTERN_C void jsGlDeleteBuffer(GlId bufferId);
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);
@@ -17,11 +24,13 @@ 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 void jsGlDeleteShader(GlId shaderId);
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 void jsGlDeleteProgram(GlId programId);
MAYBE_EXTERN_C GlId jsGlCreateProgram();
MAYBE_EXTERN_C void jsGlAttachShader(GlId programId, GlId shaderId);
MAYBE_EXTERN_C void jsGlLinkProgram(GlId programId);
@@ -29,6 +38,8 @@ 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 jsGlClearDepth(r32 depth);
MAYBE_EXTERN_C void jsGlClearStencil(r32 stencilValue);
MAYBE_EXTERN_C void jsGlClear(int bufferBits);
MAYBE_EXTERN_C void jsGlDrawArrays(GlEnum geometryType, int startIndex, int count);
MAYBE_EXTERN_C GlId jsGlGetUniformLocation(GlId programId, int nameLength, const char* namePntr);