Fix Graphical Glitches On Some NVIDIA GPUs And Fix Crash When Taking Large Screenshots

This commit is contained in:
TheBrokenRail 2023-08-02 01:08:31 -04:00
parent a622858a18
commit de18189b44
3 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#version 100 #version 100
precision mediump float; precision highp float;
// Texture // Texture
uniform bool u_has_texture; uniform bool u_has_texture;
uniform sampler2D u_texture_unit; uniform sampler2D u_texture_unit;

View File

@ -1,5 +1,5 @@
#version 100 #version 100
precision mediump float; precision highp float;
// Matrices // Matrices
uniform mat4 u_projection; uniform mat4 u_projection;
uniform mat4 u_model_view; uniform mat4 u_model_view;

View File

@ -144,7 +144,8 @@ void screenshot_take(char *home) {
int size = height * line_size; int size = height * line_size;
// Read Pixels // Read Pixels
unsigned char pixels[size]; unsigned char *pixels = (unsigned char *) malloc(size);
ALLOC_CHECK(pixels);
glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
// Save Image // Save Image
@ -157,4 +158,5 @@ void screenshot_take(char *home) {
// Free // Free
free(file); free(file);
free(screenshots); free(screenshots);
free(pixels);
} }