void setActiveTexture(int texUnit) {m_activeTexture = texUnit; };
int getActiveTexture() const { return m_activeTexture; }
+ void unBindBuffer(GLuint id)
+ {
+ if (m_currentArrayVbo == id) m_currentArrayVbo = 0;
+ else if (m_currentIndexVbo == id) m_currentIndexVbo = 0;
+ }
+
int bindBuffer(GLenum target, GLuint id)
{
int err = 0;
void GL2Encoder::s_glBufferData(void * self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage)
{
GL2Encoder *ctx = (GL2Encoder *) self;
+ SET_ERROR_IF(!(target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER), GL_INVALID_ENUM);
GLuint bufferId = ctx->m_state->getBuffer(target);
SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION);
SET_ERROR_IF(size<0, GL_INVALID_VALUE);
void GL2Encoder::s_glBufferSubData(void * self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data)
{
GL2Encoder *ctx = (GL2Encoder *) self;
+ SET_ERROR_IF(!(target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER), GL_INVALID_ENUM);
GLuint bufferId = ctx->m_state->getBuffer(target);
SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION);
SET_ERROR_IF(n<0, GL_INVALID_VALUE);
for (int i=0; i<n; i++) {
ctx->m_shared->deleteBufferData(buffers[i]);
+ ctx->m_state->unBindBuffer(buffers[i]);
ctx->m_glDeleteBuffers_enc(self,1,&buffers[i]);
}
}