Convert GL_SHORT to proper float on conversion

merge-requests/106/merge
Spencer Elliott 2023-09-26 18:51:29 +07:00 committed by Luke Benstead
parent 420e2d75f2
commit 79172452f2
2 changed files with 7 additions and 6 deletions

@ -3,6 +3,7 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include "private.h"
#include "platform.h"
@ -159,8 +160,8 @@ static void _readVertexData2us2f(const GLubyte* in, GLubyte* out) {
const GLushort* input = (const GLushort*) in;
float* output = (float*) out;
output[0] = input[0];
output[1] = input[1];
output[0] = (float)input[0] / SHRT_MAX;
output[1] = (float)input[1] / SHRT_MAX;
}
static void _readVertexData2ui2f(const GLubyte* in, GLubyte* out) {

@ -59,10 +59,10 @@ int ImageLoad(char *filename, Image *image) {
fread(&header, sizeof(header), 1, file);
GLboolean twiddled = (header.type & (1 << 25)) < 1;
GLboolean compressed = (header.type & (1 << 29)) > 0;
GLboolean mipmapped = (header.type & (1 << 30)) > 0;
GLboolean strided = (header.type & (1 << 24)) > 0;
GLboolean twiddled = (header.type & (1 << 26)) < 1;
GLboolean compressed = (header.type & (1 << 30)) > 0;
GLboolean mipmapped = (header.type & (1 << 31)) > 0;
GLboolean strided = (header.type & (1 << 25)) > 0;
GLuint format = (header.type >> 27) & 0b111;
image->data = (char *) malloc (header.size);