Fixed conflict between VAO and OpenGL::BindBuffer
Former-commit-id: b1182e3b0327a73431a8e81106df9109e9a80cc2
This commit is contained in:
@@ -72,6 +72,7 @@ class NAZARA_API NzOpenGL
|
|||||||
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 BindTexture(unsigned int textureUnit, nzImageType type, GLuint id);
|
||||||
|
static void BindVertexArray(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);
|
||||||
|
|||||||
@@ -274,6 +274,15 @@ void NzOpenGL::BindTexture(unsigned int textureUnit, nzImageType type, GLuint id
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NzOpenGL::BindVertexArray(GLuint id)
|
||||||
|
{
|
||||||
|
// Je ne pense pas que ça soit une bonne idée de le mettre en cache, c'est un objet "spécial"
|
||||||
|
glBindVertexArray(id);
|
||||||
|
|
||||||
|
// On invalide les bindings des buffers (Overridés par le VertexArray)
|
||||||
|
std::memset(s_buffersBinding, 0, (nzBufferType_Max+1)*sizeof(GLuint));
|
||||||
|
}
|
||||||
|
|
||||||
void NzOpenGL::DeleteBuffer(nzBufferType type, GLuint id)
|
void NzOpenGL::DeleteBuffer(nzBufferType type, GLuint id)
|
||||||
{
|
{
|
||||||
glDeleteBuffers(1, &id);
|
glDeleteBuffers(1, &id);
|
||||||
|
|||||||
@@ -1498,6 +1498,7 @@ bool NzRenderer::EnsureStateUpdate()
|
|||||||
|
|
||||||
VAO_Key key(NzContext::GetCurrent(), s_indexBuffer, s_vertexBuffer, s_instancing);
|
VAO_Key key(NzContext::GetCurrent(), s_indexBuffer, s_vertexBuffer, s_instancing);
|
||||||
auto it = s_vaos.find(key);
|
auto it = s_vaos.find(key);
|
||||||
|
|
||||||
if (it == s_vaos.end())
|
if (it == s_vaos.end())
|
||||||
{
|
{
|
||||||
// On créé notre VAO
|
// On créé notre VAO
|
||||||
@@ -1574,6 +1575,8 @@ bool NzRenderer::EnsureStateUpdate()
|
|||||||
NzHardwareBuffer* indexBufferImpl = static_cast<NzHardwareBuffer*>(s_indexBuffer->GetBuffer()->GetImpl());
|
NzHardwareBuffer* indexBufferImpl = static_cast<NzHardwareBuffer*>(s_indexBuffer->GetBuffer()->GetImpl());
|
||||||
indexBufferImpl->Bind();
|
indexBufferImpl->Bind();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
NzOpenGL::BindBuffer(nzBufferType_Index, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_useVertexArrayObjects)
|
if (s_useVertexArrayObjects)
|
||||||
@@ -1583,7 +1586,7 @@ bool NzRenderer::EnsureStateUpdate()
|
|||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
|
||||||
// Nous (re)bindons le VAO pour définir les attributs de vertice
|
// Nous (re)bindons le VAO pour définir les attributs de vertice
|
||||||
glBindVertexArray(vao);
|
NzOpenGL::BindVertexArray(vao);
|
||||||
}
|
}
|
||||||
|
|
||||||
s_updateFlags &= ~Update_VAO;
|
s_updateFlags &= ~Update_VAO;
|
||||||
|
|||||||
Reference in New Issue
Block a user