I’m trying to use glbindbufferrange to GL_Uniform_buffer, it continue throw out the GL_INVALID_VALUE, even though i’ve already follow the gles rule, such as offset is a multiple of GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, etc. Here is my test code:
GLint uniformBufferAlignSize = 0;
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT,&uniformBufferAlignSize);
GLuint res = 0;
glGenBuffers(1, &res);
glBindBuffer(GL_UNIFORM_BUFFER, res);
CheckOpenGLES3Error(""); --- no error
glBufferData(GL_UNIFORM_BUFFER, 10 * uniformBufferAlignSize, NULL, GL_DYNAMIC_DRAW);
CheckOpenGLES3Error(""); -- noerror
glBindBufferRange(GL_UNIFORM_BUFFER, 1, res, 0, uniformBufferAlignSize);
CheckOpenGLES3Error(""); -- GL_INVALID_VALUE
glBindBufferRange(GL_UNIFORM_BUFFER, 1, res, uniformBufferAlignSize, uniformBufferAlignSize);
CheckOpenGLES3Error(""); -- GL_INVALID_VALUE