mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-04 05:23:34 +00:00
Add compressed texture formats;
This commit is contained in:
parent
b76480f9f2
commit
b25d345e72
|
@ -49,7 +49,7 @@ void lovrGraphicsInit() {
|
||||||
// Initialize all the things
|
// Initialize all the things
|
||||||
glfwMakeContextCurrent(state.window);
|
glfwMakeContextCurrent(state.window);
|
||||||
glfwSetWindowCloseCallback(state.window, onCloseWindow);
|
glfwSetWindowCloseCallback(state.window, onCloseWindow);
|
||||||
#ifdef _WIN32
|
#ifndef LOVR_WEB
|
||||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||||
#endif
|
#endif
|
||||||
glfwSetTime(0);
|
glfwSetTime(0);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#define GLFW_INCLUDE_GLCOREARB
|
#define GLFW_INCLUDE_GLCOREARB
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#define APIENTRY __stdcall
|
#define APIENTRY __stdcall
|
||||||
#include "glad/glad.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "glad/glad.h"
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
|
@ -17,6 +17,27 @@ const TextureFormat FORMAT_RGBA = {
|
||||||
.blockBytes = 4
|
.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* lovrTextureDataGetBlank(int width, int height, uint8_t value, TextureFormat format) {
|
||||||
TextureData* textureData = malloc(sizeof(TextureData));
|
TextureData* textureData = malloc(sizeof(TextureData));
|
||||||
if (!textureData) return NULL;
|
if (!textureData) return NULL;
|
||||||
|
|
|
@ -11,7 +11,7 @@ typedef struct {
|
||||||
int compressed;
|
int compressed;
|
||||||
} TextureFormat;
|
} TextureFormat;
|
||||||
|
|
||||||
extern const TextureFormat FORMAT_RGB, FORMAT_RGBA;
|
extern const TextureFormat FORMAT_RGB, FORMAT_RGBA, FORMAT_DXT1, FORMAT_DXT3, FORMAT_DXT5;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue