shithub: wipeout

Download patch

ref: 676d4ef6eeeaa380c586f80c49449bd7a5336ce8
parent: 5fcf2feec81e753d0188bb10da9db0a5ee061957
author: Dominic Szablewski <dominic@phoboslab.org>
date: Tue Aug 15 14:04:05 EDT 2023

Use glGenTextures() and glFramebufferTexture2D() everywhere instead of creating stubs; close #20

--- a/src/render_gl.c
+++ b/src/render_gl.c
@@ -3,10 +3,7 @@
 #if defined(__APPLE__) && defined(__MACH__)
 	#include <OpenGL/gl.h>
 	#include <OpenGL/glext.h>
-
-	void glCreateTextures(GLuint ignored, GLsizei n, GLuint *name) {
-		glGenTextures(1, name);
-	}
+	
 	#define glGenVertexArrays glGenVertexArraysAPPLE
 	#define glBindVertexArray glBindVertexArrayAPPLE
 	#define glDeleteVertexArrays glDeleteVertexArraysAPPLE
@@ -15,16 +12,6 @@
 #elif defined(__unix__)
 	#include <GL/glew.h>
 	
-	#ifdef __EMSCRIPTEN__
-		void glCreateTextures(GLuint ignored, GLsizei n, GLuint *name) {
-			glGenTextures(1, name);
-		}
-
-		void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level) {
-			glFramebufferTexture2D(target, attachment, GL_TEXTURE_2D, texture, level);
-		}
-	#endif
-
 // WINDOWS
 #else
 	#include <windows.h>
@@ -419,7 +406,7 @@
 
 	// Atlas Texture
 
-	glCreateTextures(GL_TEXTURE_2D, 1, &atlas_texture);
+	glGenTextures(1, &atlas_texture);
 	glBindTexture(GL_TEXTURE_2D, atlas_texture);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, RENDER_USE_MIPMAPS ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR);
@@ -559,7 +546,7 @@
 	glBindFramebuffer(GL_FRAMEBUFFER, backbuffer);
 	glBindRenderbuffer(GL_RENDERBUFFER, backbuffer_depth_buffer);	
 	glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, backbuffer_depth_buffer);
-	glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, backbuffer_texture, 0);
+	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, backbuffer_texture, 0);
 	
 	glBindRenderbuffer(GL_RENDERBUFFER, backbuffer_depth_buffer);
 	glRenderbufferStorage(GL_RENDERBUFFER, RENDER_DEPTH_BUFFER_INTERNAL_FORMAT, backbuffer_size.x, backbuffer_size.y);