Replies: 1 comment 1 reply
-
Interesting finding: if instead of using a 3-channel texture, I use a 4-channel texture, it works! struct Color { u8 r, g, b, a; };
const Color pixels[] = {
{255, 0, 0, 255}, {0, 255, 0, 255},
{0, 0, 255, 255}, {255, 255, 0, 255}
};
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glGenerateMipmap(GL_TEXTURE_2D); This is so weird! 😱 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm having a problem with
GL_LINEAR_MIPMAP_LINEAR
.I have asked in StackOverflow too: https://stackoverflow.com/questions/72288813/textures-show-black-when-using-gl-linear-mipmap-linear-in-emscripten
I have a small program that just draws a full screen quad with a texture.
This program works fine when I run it on Windows.
However it seems to fail when compiling to WebGL2 (GLES3) using Emscripten. It just shows a black quad.
I have figured out that the problem happens only when I enable mipmapping.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
This is the code that initializes the texture:
I have found that, if instead of calling glGenerateMipmap, I specify the mip levels manually, it works!
Repo with the full code: https://github.com/tuket/emscripten_problem_with_mipmap_textures
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions