diff options
author | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2016-12-03 11:48:16 +0100 |
---|---|---|
committer | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2016-12-03 11:48:16 +0100 |
commit | 8f6b446eb029bd2dca0db5869d7bcd22e4837e29 (patch) | |
tree | 07e474e32a955155d1cc0cf5e6c32260114dfee4 | |
parent | d4e9daf7eae3860103bdc24dc33da63faf87a466 (diff) | |
download | sherlock.lv2-8f6b446eb029bd2dca0db5869d7bcd22e4837e29.tar.xz |
add fallback for GenerateMipMap for GL >= 1.4.
-rw-r--r-- | nk_pugl.h | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -909,7 +909,7 @@ nk_pugl_icon_load(nk_pugl_window_t *win, const char *filename) int w, h, n; uint8_t *data = stbi_load(filename, &w, &h, &n, 0); - if(data && win->glGenerateMipmap) + if(data) { puglEnterContext(win->view); { @@ -919,8 +919,11 @@ nk_pugl_icon_load(nk_pugl_window_t *win, const char *filename) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + if(!win->glGenerateMipmap) // for GL >= 1.4 && < 3.1 + glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); - win->glGenerateMipmap(GL_TEXTURE_2D); + if(win->glGenerateMipmap) // for GL >= 3.1 + win->glGenerateMipmap(GL_TEXTURE_2D); } puglLeaveContext(win->view, false); |