mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
Reverted commit 8c64a0c (love.graphics.setCanvas(nil) erroring)
This commit is contained in:
@@ -160,7 +160,7 @@ bool Graphics::setMode(int width, int height)
|
||||
|
||||
// Enable textures
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
gl.setActiveTextureUnit(0);
|
||||
gl.setTextureUnit(0);
|
||||
|
||||
// Set the viewport to top-left corner
|
||||
gl.setViewport(OpenGL::Viewport(0, 0, width, height));
|
||||
|
||||
@@ -232,7 +232,7 @@ OpenGL::Viewport OpenGL::getScissor() const
|
||||
return state.scissor;
|
||||
}
|
||||
|
||||
void OpenGL::setActiveTextureUnit(int textureunit)
|
||||
void OpenGL::setTextureUnit(int textureunit)
|
||||
{
|
||||
if (textureunit < 0 || (size_t) textureunit >= state.textureUnits.size())
|
||||
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])
|
||||
{
|
||||
int oldtextureunit = state.curTextureUnit;
|
||||
setActiveTextureUnit(textureunit);
|
||||
setTextureUnit(textureunit);
|
||||
|
||||
state.textureUnits[textureunit] = texture;
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
if (restoreprev)
|
||||
setActiveTextureUnit(oldtextureunit);
|
||||
setTextureUnit(oldtextureunit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
*
|
||||
* @param textureunit Index in the range of [0, maxtextureunits-1]
|
||||
**/
|
||||
void setActiveTextureUnit(int textureunit);
|
||||
void setTextureUnit(int textureunit);
|
||||
|
||||
/**
|
||||
* Helper for binding an OpenGL texture.
|
||||
|
||||
@@ -346,7 +346,7 @@ void Shader::attach(bool temporary)
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
// reset texture unit
|
||||
gl.setActiveTextureUnit(0);
|
||||
gl.setTextureUnit(0);
|
||||
|
||||
// increment global shader texture id counter for this texture unit, if we haven't already
|
||||
if (activeTextureUnits[textureunit-1] == 0)
|
||||
|
||||
@@ -963,8 +963,7 @@ int w_setCanvas(lua_State *L)
|
||||
instance->discardStencil();
|
||||
|
||||
// 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();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user