Don't include glad on web;

This commit is contained in:
bjorn 2017-07-31 02:41:44 -07:00
parent 8464463d4e
commit 6a13ac5ee1
2 changed files with 8 additions and 2 deletions

View File

@ -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) {

View File

@ -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 <GLFW/glfw3.h>