Add compressed texture formats;

This commit is contained in:
bjorn 2017-07-22 03:14:36 -07:00
parent b76480f9f2
commit b25d345e72
4 changed files with 24 additions and 3 deletions

View File

@ -49,7 +49,7 @@ void lovrGraphicsInit() {
// Initialize all the things
glfwMakeContextCurrent(state.window);
glfwSetWindowCloseCallback(state.window, onCloseWindow);
#ifdef _WIN32
#ifndef LOVR_WEB
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
#endif
glfwSetTime(0);

View File

@ -6,7 +6,7 @@
#define GLFW_INCLUDE_GLCOREARB
#elif _WIN32
#define APIENTRY __stdcall
#include "glad/glad.h"
#endif
#include "glad/glad.h"
#include <GLFW/glfw3.h>

View File

@ -17,6 +17,27 @@ const TextureFormat FORMAT_RGBA = {
.blockBytes = 4
};
const TextureFormat FORMAT_DXT1 = {
.glInternalFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
.glFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
.compressed = 1,
.blockBytes = 8
};
const TextureFormat FORMAT_DXT3 = {
.glInternalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
.glFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
.compressed = 1,
.blockBytes = 16
};
const TextureFormat FORMAT_DXT5 = {
.glInternalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
.glFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
.compressed = 1,
.blockBytes = 16
};
TextureData* lovrTextureDataGetBlank(int width, int height, uint8_t value, TextureFormat format) {
TextureData* textureData = malloc(sizeof(TextureData));
if (!textureData) return NULL;

View File

@ -11,7 +11,7 @@ typedef struct {
int compressed;
} TextureFormat;
extern const TextureFormat FORMAT_RGB, FORMAT_RGBA;
extern const TextureFormat FORMAT_RGB, FORMAT_RGBA, FORMAT_DXT1, FORMAT_DXT3, FORMAT_DXT5;
typedef struct {