From 6a13ac5ee1fdb55c76307023f71b7da959fbfab3 Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 31 Jul 2017 02:41:44 -0700 Subject: [PATCH] Don't include glad on web; --- src/graphics/texture.c | 6 +++++- src/lib/glfw.h | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/graphics/texture.c b/src/graphics/texture.c index 2a71bd4c..1cf3fcc7 100644 --- a/src/graphics/texture.c +++ b/src/graphics/texture.c @@ -17,8 +17,11 @@ static void lovrTextureCreateStorage(Texture* texture) { int mipmapCount = log2(MAX(w, h)) + 1; GLenum internalFormat = textureData->format.glInternalFormat; GLenum format = textureData->format.glFormat; +#ifndef LOVR_WEB if (GLAD_GL_ARB_texture_storage) { +#endif glTexStorage2D(GL_TEXTURE_2D, mipmapCount, internalFormat, w, h); +#ifndef LOVR_WEB } else { for (int i = 0; i < mipmapCount; i++) { glTexImage2D(GL_TEXTURE_2D, i, internalFormat, w, h, 0, format, GL_UNSIGNED_BYTE, NULL); @@ -26,6 +29,7 @@ static void lovrTextureCreateStorage(Texture* texture) { h = MAX(h >> 1, 1); } } +#endif } Texture* lovrTextureCreate(TextureData* textureData) { @@ -226,7 +230,7 @@ void lovrTextureSetFilter(Texture* texture, FilterMode filter, float anisotropy) break; } - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, MAX(anisotropy, 1.0)); } void lovrTextureGetWrap(Texture* texture, WrapMode* horizontal, WrapMode* vertical) { diff --git a/src/lib/glfw.h b/src/lib/glfw.h index ff36e0b5..a7777a7a 100644 --- a/src/lib/glfw.h +++ b/src/lib/glfw.h @@ -2,11 +2,13 @@ #if LOVR_WEB #define GLFW_INCLUDE_ES3 +#define GLFW_INCLUDE_GLEXT #elif __APPLE__ #define GLFW_INCLUDE_GLCOREARB +#include "glad/glad.h" #elif _WIN32 #define APIENTRY __stdcall +#include "glad/glad.h" #endif -#include "glad/glad.h" #include