mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
macOS: guard mipmap generation call on legacy GL path (#132)
glGenerateMipmap is null on the legacy GL path in some contexts; use the GL_GENERATE_MIPMAP fallback instead of crashing.
This commit is contained in:
committed by
GitHub
parent
d863ec18c3
commit
a961393df9
@@ -410,14 +410,16 @@ void opengl_texture::update_from_memory(size_t width, size_t height, const uint8
|
||||
set_filtering();
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, wrap_mode_s);
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, wrap_mode_t);
|
||||
glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
if (!glGenerateMipmap)
|
||||
glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindTexture(target, id);
|
||||
}
|
||||
glTexImage2D(target, 0, data_format, data_width, data_height, 0, data_components, GL_UNSIGNED_BYTE, raw);
|
||||
glGenerateMipmap(target);
|
||||
if (glGenerateMipmap)
|
||||
glGenerateMipmap(target);
|
||||
glFlush();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user