Bladeren bron

Imported latest love-android code 8e93b946d920 that fixes ParticleSystem:clone

fysx 10 jaren geleden
bovenliggende
commit
7eb7db1a85

+ 4 - 4
jni/love/src/libraries/glad/glad.hpp

@@ -143,10 +143,10 @@ typedef uint64_t GLuint64EXT;
 typedef struct __GLsync *GLsync;
 struct _cl_context;
 struct _cl_event;
-typedef void ( *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-typedef void ( *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-typedef void ( *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-typedef void ( *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
+typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
 typedef unsigned short GLhalfNV;
 typedef GLintptr GLvdpauSurfaceNV;
 

+ 14 - 3
jni/love/src/modules/graphics/opengl/Image.cpp

@@ -460,14 +460,19 @@ void Image::uploadTexturePadded()
 	}
 	else if (data.get())
 	{
+		GLenum xformat = GL_RGBA;
 		GLenum iformat = (format == FORMAT_SRGB) ? GL_SRGB_ALPHA : GL_RGBA;
+
+		if (GLAD_ES_VERSION_2_0 && !GLAD_ES_VERSION_3_0)
+			xformat = iformat;
+
 		glTexImage2D(GL_TEXTURE_2D,
 		             0,
 		             iformat,
 		             (GLsizei)paddedWidth,
 		             (GLsizei)paddedHeight,
 		             0,
-		             GL_RGBA,
+		             xformat,
 		             GL_UNSIGNED_BYTE,
 		             0);
 
@@ -476,7 +481,7 @@ void Image::uploadTexturePadded()
 		                0, 0,
 		                (GLsizei)width,
 		                (GLsizei)height,
-		                GL_RGBA,
+		                xformat,
 		                GL_UNSIGNED_BYTE,
 		                data->getData());
 	}
@@ -498,14 +503,20 @@ void Image::uploadTexture()
 	}
 	else if (data.get())
 	{
+		GLenum xformat = GL_RGBA;
 		GLenum iformat = (format == FORMAT_SRGB) ? GL_SRGB_ALPHA : GL_RGBA;
+
+		// The internal and external format parameters must match in OpenGL ES 2.
+		if (GLAD_ES_VERSION_2_0 && !GLAD_ES_VERSION_3_0)
+			xformat = iformat;
+
 		glTexImage2D(GL_TEXTURE_2D,
 		             0,
 		             iformat,
 		             (GLsizei)width,
 		             (GLsizei)height,
 		             0,
-		             GL_RGBA,
+		             xformat,
 		             GL_UNSIGNED_BYTE,
 		             data->getData());
 	}

+ 1 - 0
jni/love/src/modules/graphics/opengl/ParticleSystem.cpp

@@ -113,6 +113,7 @@ ParticleSystem::ParticleSystem(const ParticleSystem &p)
 	, pHead(nullptr)
 	, pTail(nullptr)
 	, particleVerts(nullptr)
+	, ibo(nullptr)
 	, texture(p.texture)
 	, active(p.active)
 	, insertMode(p.insertMode)