Small change to test_app.c. Committing as I'm reconfiguring local clone of the repo so I don't lose the work

This commit is contained in:
2025-09-02 11:58:49 -07:00
parent f2d590be13
commit bed90ad8e1

View File

@@ -66,8 +66,11 @@ WASM_EXPORT(App_ResourceLoaded) void App_ResourceLoaded(int resourceIndex, int f
{
PrintLine_D("Parsed image: %p %dx%d %d channel(s)", textureBytes, imageWidth, imageHeight, imageChannelCount);
#if 0
//NOTE: Firefox claims that this is deprecated?
jsGlPixelStorei(GL_UNPACK_FLIP_Y_WEBGL, true);
#else
//We need to reverse the rows of pixels so the image is not upside-down
//TODO: Replace with GL_UNPACK_FLIP_Y_WEBGL
u32 rowWidth = imageWidth * sizeof(u32);
u8* tempRowBuffer = AllocArray(u8, scratch, rowWidth);
for (int yIndex = 0; yIndex < imageHeight/2; yIndex++)
@@ -76,6 +79,8 @@ WASM_EXPORT(App_ResourceLoaded) void App_ResourceLoaded(int resourceIndex, int f
memcpy(&textureBytes[yIndex * rowWidth], &textureBytes[(imageHeight-1 - yIndex) * rowWidth], rowWidth);
memcpy(&textureBytes[(imageHeight-1 - yIndex) * rowWidth], tempRowBuffer, rowWidth);
}
#endif
#if 0
for (int yIndex = 0; yIndex < imageHeight; yIndex++)
{
@@ -95,7 +100,6 @@ WASM_EXPORT(App_ResourceLoaded) void App_ResourceLoaded(int resourceIndex, int f
jsGlActiveTexture(GL_TEXTURE0);
jsGlBindTexture(GL_TEXTURE_2D, app.testTexture);
// jsGlPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
// jsGlPixelStorei(GL_UNPACK_FLIP_Y_WEBGL, true);
jsGlTexImage2D(
GL_TEXTURE_2D, //bound texture type
0, //image level