From a6c783336ae473027b19f1ff83df0e47ae5bf26f Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 13 Nov 2020 12:38:11 +0100 Subject: [PATCH] Updated OpenGL texture upload as per #3523 --- Image-Loading-and-Displaying-Examples.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Image-Loading-and-Displaying-Examples.md b/Image-Loading-and-Displaying-Examples.md index 0eca849..592ec91 100644 --- a/Image-Loading-and-Displaying-Examples.md +++ b/Image-Loading-and-Displaying-Examples.md @@ -114,9 +114,13 @@ bool LoadTextureFromFile(const char* filename, GLuint* out_texture, int* out_wid // Setup filtering parameters for display glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // This is required on WebGL for non power-of-two textures + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Same // Upload pixels into texture +#if defined(GL_UNPACK_ROW_LENGTH) && !defined(__EMSCRIPTEN__) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); +#endif glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image_width, image_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data); stbi_image_free(image_data);