mirror of https://github.com/axmolengine/axmol.git
Switch to using GL_DYNAMIC_DRAW.
This commit is contained in:
parent
809b77d632
commit
6c828bbe4f
|
@ -93,9 +93,15 @@ void CCObject::setGLBufferData(void *buf, GLuint bufSize, int slot)
|
||||||
}
|
}
|
||||||
glGenBuffers(1, &(m_bufferObject[slot]));
|
glGenBuffers(1, &(m_bufferObject[slot]));
|
||||||
m_bufferSize[slot] = bufSize;
|
m_bufferSize[slot] = bufSize;
|
||||||
|
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, m_bufferObject[slot]);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, bufSize, buf, GL_DYNAMIC_DRAW);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, m_bufferObject[slot]);
|
||||||
|
glBufferSubData(GL_ARRAY_BUFFER, 0, bufSize, buf);
|
||||||
}
|
}
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_bufferObject[slot]);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, bufSize, buf, GL_STATIC_DRAW);
|
|
||||||
}
|
}
|
||||||
void CCObject::setGLIndexData(void *buf, GLuint bufSize, int slot)
|
void CCObject::setGLIndexData(void *buf, GLuint bufSize, int slot)
|
||||||
{
|
{
|
||||||
|
@ -108,9 +114,15 @@ void CCObject::setGLIndexData(void *buf, GLuint bufSize, int slot)
|
||||||
}
|
}
|
||||||
glGenBuffers(1, &(m_indexBufferObject[slot]));
|
glGenBuffers(1, &(m_indexBufferObject[slot]));
|
||||||
m_indexBufferSize[slot] = bufSize;
|
m_indexBufferSize[slot] = bufSize;
|
||||||
|
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBufferObject[slot]);
|
||||||
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufSize, buf, GL_DYNAMIC_DRAW);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBufferObject[slot]);
|
||||||
|
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, bufSize, buf);
|
||||||
}
|
}
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBufferObject[slot]);
|
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufSize, buf, GL_STATIC_DRAW);
|
|
||||||
}
|
}
|
||||||
#endif // EMSCRIPTEN
|
#endif // EMSCRIPTEN
|
||||||
CCObject* CCObject::copy()
|
CCObject* CCObject::copy()
|
||||||
|
|
Loading…
Reference in New Issue