Browse Source

Reverted commit 8c64a0c (love.graphics.setCanvas(nil) erroring)

Alex Szpakowski 12 years ago
parent
commit
f41a2ed910

+ 1 - 1
src/modules/graphics/opengl/Graphics.cpp

@@ -160,7 +160,7 @@ bool Graphics::setMode(int width, int height)
 
 
 	// Enable textures
 	// Enable textures
 	glEnable(GL_TEXTURE_2D);
 	glEnable(GL_TEXTURE_2D);
-	gl.setActiveTextureUnit(0);
+	gl.setTextureUnit(0);
 
 
 	// Set the viewport to top-left corner
 	// Set the viewport to top-left corner
 	gl.setViewport(OpenGL::Viewport(0, 0, width, height));
 	gl.setViewport(OpenGL::Viewport(0, 0, width, height));

+ 3 - 3
src/modules/graphics/opengl/OpenGL.cpp

@@ -232,7 +232,7 @@ OpenGL::Viewport OpenGL::getScissor() const
 	return state.scissor;
 	return state.scissor;
 }
 }
 
 
-void OpenGL::setActiveTextureUnit(int textureunit)
+void OpenGL::setTextureUnit(int textureunit)
 {
 {
 	if (textureunit < 0 || (size_t) textureunit >= state.textureUnits.size())
 	if (textureunit < 0 || (size_t) textureunit >= state.textureUnits.size())
 		throw love::Exception("Invalid texture unit index (%d).", textureunit);
 		throw love::Exception("Invalid texture unit index (%d).", textureunit);
@@ -265,13 +265,13 @@ void OpenGL::bindTextureToUnit(GLuint texture, int textureunit, bool restoreprev
 	if (texture != state.textureUnits[textureunit])
 	if (texture != state.textureUnits[textureunit])
 	{
 	{
 		int oldtextureunit = state.curTextureUnit;
 		int oldtextureunit = state.curTextureUnit;
-		setActiveTextureUnit(textureunit);
+		setTextureUnit(textureunit);
 
 
 		state.textureUnits[textureunit] = texture;
 		state.textureUnits[textureunit] = texture;
 		glBindTexture(GL_TEXTURE_2D, texture);
 		glBindTexture(GL_TEXTURE_2D, texture);
 
 
 		if (restoreprev)
 		if (restoreprev)
-			setActiveTextureUnit(oldtextureunit);
+			setTextureUnit(oldtextureunit);
 	}
 	}
 }
 }
 
 

+ 1 - 1
src/modules/graphics/opengl/OpenGL.h

@@ -125,7 +125,7 @@ public:
 	 *
 	 *
 	 * @param textureunit Index in the range of [0, maxtextureunits-1]
 	 * @param textureunit Index in the range of [0, maxtextureunits-1]
 	 **/
 	 **/
-	void setActiveTextureUnit(int textureunit);
+	void setTextureUnit(int textureunit);
 
 
 	/**
 	/**
 	 * Helper for binding an OpenGL texture.
 	 * Helper for binding an OpenGL texture.

+ 2 - 2
src/modules/graphics/opengl/Shader.cpp

@@ -346,7 +346,7 @@ void Shader::attach(bool temporary)
 		}
 		}
 
 
 		// We always want to use texture unit 0 for everyhing else.
 		// We always want to use texture unit 0 for everyhing else.
-		gl.setActiveTextureUnit(0);
+		gl.setTextureUnit(0);
 	}
 	}
 }
 }
 
 
@@ -548,7 +548,7 @@ void Shader::sendTexture(const std::string &name, GLuint texture)
 	glUniform1i(u.location, textureunit);
 	glUniform1i(u.location, textureunit);
 
 
 	// reset texture unit
 	// reset texture unit
-	gl.setActiveTextureUnit(0);
+	gl.setTextureUnit(0);
 
 
 	// increment global shader texture id counter for this texture unit, if we haven't already
 	// increment global shader texture id counter for this texture unit, if we haven't already
 	if (activeTextureUnits[textureunit-1] == 0)
 	if (activeTextureUnits[textureunit-1] == 0)

+ 1 - 2
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -963,8 +963,7 @@ int w_setCanvas(lua_State *L)
 	instance->discardStencil();
 	instance->discardStencil();
 
 
 	// called with none -> reset to default buffer
 	// called with none -> reset to default buffer
-	// nil is an error, to help people with typoes
-	if (lua_isnone(L,1))
+	if (lua_isnoneornil(L,1))
 	{
 	{
 		Canvas::bindDefaultCanvas();
 		Canvas::bindDefaultCanvas();
 		return 0;
 		return 0;