Bug fixes in the SDL port

This commit is contained in:
Lior Halphon 2017-12-30 17:01:23 +02:00
parent a4465b72e7
commit 2205493862
3 changed files with 11 additions and 4 deletions

View File

@ -5,11 +5,10 @@
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <sys/time.h>
#ifndef _WIN32
#include <sys/select.h>
#endif
#include <unistd.h>
#endif
#include "gb.h"
void GB_attributed_logv(GB_gameboy_t *gb, GB_log_attributes attributes, const char *fmt, va_list args)

View File

@ -451,7 +451,7 @@ usage:
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
GLint major, minor;
GLint major = 0, minor = 0;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);

View File

@ -64,7 +64,7 @@ static GLuint create_program(const char *vsh, const char *fsh)
bool init_shader_with_name(shader_t *shader, const char *name)
{
GLint major, minor;
GLint major = 0, minor = 0;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
@ -184,6 +184,14 @@ void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous,un
void free_shader(shader_t *shader)
{
GLint major = 0, minor = 0;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
if (major * 0x100 + minor < 0x302) {
return;
}
glDeleteProgram(shader->program);
glDeleteTextures(1, &shader->texture);
glDeleteTextures(1, &shader->previous_texture);