mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Manually keep track of bound textures, so we don't have to poll each frame
Patch submitted by slime73.
This commit is contained in:
@@ -265,12 +265,7 @@ namespace opengl
|
||||
if (texture == 0)
|
||||
return;
|
||||
|
||||
GLuint boundTex;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *)&boundTex);
|
||||
|
||||
// only bind if this texture is not already bound
|
||||
if (boundTex != texture)
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
bindTexture(texture);
|
||||
}
|
||||
|
||||
bool Image::load()
|
||||
@@ -294,7 +289,7 @@ namespace opengl
|
||||
bool Image::loadVolatilePOT()
|
||||
{
|
||||
glGenTextures(1,(GLuint*)&texture);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
bindTexture(texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
@@ -340,7 +335,7 @@ namespace opengl
|
||||
bool Image::loadVolatileNPOT()
|
||||
{
|
||||
glGenTextures(1,(GLuint*)&texture);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
bindTexture(texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
@@ -370,7 +365,7 @@ namespace opengl
|
||||
// Delete the hardware texture.
|
||||
if (texture != 0)
|
||||
{
|
||||
glDeleteTextures(1, (GLuint*)&texture);
|
||||
deleteTexture(texture);
|
||||
texture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user