Skip to content

Commit 92a16bc

Browse files
committed
Make STB_Image and the demos C89 compatible
1 parent e72bc2f commit 92a16bc

File tree

12 files changed

+1364
-7868
lines changed

12 files changed

+1364
-7868
lines changed

demo/common/file_browser.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#include <string.h> // strcpy, strlen
1+
#include <string.h> /* strcpy, strlen */
22

3-
#ifdef __unix__
4-
#include <dirent.h>
5-
#include <unistd.h>
3+
#if defined(__unix__) || defined(__MINGW64__)
4+
#include <dirent.h>
5+
#include <unistd.h>
66
#endif
77

88
#ifndef _WIN32
9-
# include <pwd.h>
9+
#include <pwd.h>
1010
#endif
1111

1212
struct icons {
@@ -110,12 +110,11 @@ icon_load(const char *filename)
110110

111111
glGenTextures(1, &tex);
112112
glBindTexture(GL_TEXTURE_2D, tex);
113-
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
114-
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST);
113+
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
114+
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
115115
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
116116
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
117117
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
118-
glGenerateMipmap(GL_TEXTURE_2D);
119118
stbi_image_free(data);
120119
return nk_image_id((int)tex);
121120
}

demo/common/image.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* STB Image does not compile as C89 :[ */
22
#define STB_IMAGE_IMPLEMENTATION
3-
#include "../../demo/common/filebrowser/stb_image.h"
3+
#include "../../demo/common/libs/stb_image_c89.h"
44

55
struct testImage {
66
GLuint gpuTextureID;

0 commit comments

Comments
 (0)