Added OpenGL::BindTexture(unit, type, id)
+ Fixed OpenGL::DeleteTexture Former-commit-id: 124ac3316f604e436378aed8d663f0d2b5889cd3
This commit is contained in:
@@ -68,6 +68,7 @@ class NAZARA_API NzOpenGL
|
|||||||
static void BindBuffer(nzBufferType type, GLuint id);
|
static void BindBuffer(nzBufferType type, GLuint id);
|
||||||
static void BindProgram(GLuint id);
|
static void BindProgram(GLuint id);
|
||||||
static void BindTexture(nzImageType type, GLuint id);
|
static void BindTexture(nzImageType type, GLuint id);
|
||||||
|
static void BindTexture(unsigned int textureUnit, nzImageType type, GLuint id);
|
||||||
|
|
||||||
static void DeleteBuffer(nzBufferType type, GLuint id);
|
static void DeleteBuffer(nzBufferType type, GLuint id);
|
||||||
static void DeleteProgram(GLuint id);
|
static void DeleteProgram(GLuint id);
|
||||||
|
|||||||
@@ -141,6 +141,17 @@ void NzOpenGL::BindTexture(nzImageType type, GLuint id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NzOpenGL::BindTexture(unsigned int textureUnit, nzImageType type, GLuint id)
|
||||||
|
{
|
||||||
|
if (s_texturesBinding[textureUnit] != id)
|
||||||
|
{
|
||||||
|
SetTextureUnit(textureUnit);
|
||||||
|
|
||||||
|
glBindTexture(TextureTarget[type], id);
|
||||||
|
s_texturesBinding[textureUnit] = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NzOpenGL::DeleteBuffer(nzBufferType type, GLuint id)
|
void NzOpenGL::DeleteBuffer(nzBufferType type, GLuint id)
|
||||||
{
|
{
|
||||||
glDeleteBuffers(1, &id);
|
glDeleteBuffers(1, &id);
|
||||||
@@ -158,8 +169,12 @@ void NzOpenGL::DeleteProgram(GLuint id)
|
|||||||
void NzOpenGL::DeleteTexture(GLuint id)
|
void NzOpenGL::DeleteTexture(GLuint id)
|
||||||
{
|
{
|
||||||
glDeleteTextures(1, &id);
|
glDeleteTextures(1, &id);
|
||||||
if (s_texturesBinding[s_textureUnit] == id)
|
|
||||||
s_texturesBinding[s_textureUnit] = 0;
|
for (GLuint& binding : s_texturesBinding)
|
||||||
|
{
|
||||||
|
if (binding == id)
|
||||||
|
binding = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint NzOpenGL::GetCurrentBuffer(nzBufferType type)
|
GLuint NzOpenGL::GetCurrentBuffer(nzBufferType type)
|
||||||
|
|||||||
Reference in New Issue
Block a user