mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Flush vertex attribs when the buffer object changes. Fixes #697.
This commit is contained in:
parent
a93a119ee2
commit
48c6fad09e
2 changed files with 6 additions and 1 deletions
|
@ -429,6 +429,9 @@ void lcContext::SetDefaultState()
|
|||
mIndexBufferPointer = nullptr;
|
||||
mVertexBufferOffset = (char*)~0;
|
||||
|
||||
for (int AttribIndex = 0; AttribIndex < static_cast<int>(lcProgramAttrib::Count); AttribIndex++)
|
||||
mVertexAttribState[AttribIndex] = lcVertexAttribState();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
mTexture2D = 0;
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
|
||||
|
@ -874,7 +877,7 @@ void lcContext::SetVertexAttribPointer(lcProgramAttrib Attrib, GLint Size, GLenu
|
|||
const int Index = static_cast<int>(Attrib);
|
||||
lcVertexAttribState& State = mVertexAttribState[Index];
|
||||
|
||||
if (State.Size != Size || State.Type != Type || State.Normalized != Normalized || State.Stride != Stride || State.Pointer != Pointer)
|
||||
if (State.Size != Size || State.Type != Type || State.Normalized != Normalized || State.Stride != Stride || State.Pointer != Pointer || State.VertexBufferObject != mVertexBufferObject)
|
||||
{
|
||||
glVertexAttribPointer(Index, Size, Type, Normalized, Stride, Pointer);
|
||||
|
||||
|
@ -883,6 +886,7 @@ void lcContext::SetVertexAttribPointer(lcProgramAttrib Attrib, GLint Size, GLenu
|
|||
State.Normalized = Normalized;
|
||||
State.Stride = Stride;
|
||||
State.Pointer = Pointer;
|
||||
State.VertexBufferObject = mVertexBufferObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ struct lcVertexAttribState
|
|||
bool Enabled = 0;
|
||||
GLsizei Stride = 0;
|
||||
const void* Pointer = nullptr;
|
||||
GLuint VertexBufferObject = 0;
|
||||
};
|
||||
|
||||
class lcContext : protected QOpenGLFunctions
|
||||
|
|
Loading…
Add table
Reference in a new issue