diff src/scripts/graphics.lua @ 1201:b1159eb2d066

changed shadereffect texture image unit counter and map to be non-static, get max texture units from max combined TIUs instead of max fragment shader TIUs, added the current MVP matrix as an argument to the vertex shader transform function, reduced code duplication in ShaderEffect::sendImage and sendCanvas
author Alexander Szpakowski <amaranth72@gmail.com>
date Fri, 21 Dec 2012 05:03:50 -0400
parents 448da0a19ddb
children 472f719fc19f
line wrap: on
line diff
--- a/src/scripts/graphics.lua	Thu Dec 20 21:51:31 2012 -0400
+++ b/src/scripts/graphics.lua	Fri Dec 21 05:03:50 2012 -0400
@@ -1299,7 +1299,7 @@
 void main() {
 	gl_TexCoord[0] = gl_MultiTexCoord0;
 	gl_FrontColor = gl_Color;
-	gl_Position = transform(gl_Vertex);
+	gl_Position = transform(gl_ModelViewProjectionMatrix, gl_Vertex);
 }]],
 	}
 	
@@ -1349,7 +1349,7 @@
 			fragcode = table.concat{GLSL_FRAG.HEADER, "\n", fragcode, GLSL_FRAG.FOOTER}
 		end
 		
-		return vertcode, fragcode 
+		return vertcode, fragcode
 	end
 
 	function love.graphics._transformGLSLErrorMessages(message)
@@ -1366,7 +1366,11 @@
 				linenumber, what, message = l:match("^%w+: 0:(%d+):%s*(%w+)%([^%)]+%)%s*(.+)$")
 			end
 			if linenumber and what and message then
-				linenumber = linenumber - GLSL_HEADER_LINE_COUNT
+				local headerlinecount = GLSL_FRAG.HEADER_LINE_COUNT
+				if shadertype == "vertex" then
+					headerlinecount = GLSL_VERT.HEADER_LINE_COUNT
+				end
+				linenumber = linenumber - headerlinecount
 				lines[#lines+1] = ("Line %d: %s: %s"):format(linenumber, what, message)
 			end
 		end