//[-------------------------------------------------------] //[ Public virtual PLRenderer::ProgramUniformBlock functions ] //[-------------------------------------------------------] bool ProgramUniformBlockGLSL::SetUniformBuffer(PLRenderer::UniformBuffer *pUniformBuffer, uint32 nBindingPoint) { // Is there an uniform buffer given? if (pUniformBuffer) { // The given uniform buffer must have at least the same number of bytes as this uniform block and the shader language must match! if (m_nOpenGLUniformBlockSize <= static_cast<GLint>(pUniformBuffer->GetSize()) && m_sShaderLanguage == pUniformBuffer->GetShaderLanguage()) { // Attach the buffer to the given UBO binding point glBindBufferBaseEXT(GL_UNIFORM_BUFFER, nBindingPoint, static_cast<UniformBuffer*>(pUniformBuffer)->GetOpenGLUniformBuffer()); } else { // Error! return false; } } else { // Attach no buffer to the given UBO binding point glBindBufferBaseEXT(GL_UNIFORM_BUFFER, nBindingPoint, 0); } // Is the uniform block already associated with this binding point? (this test safes some graphics API calls) if (m_nBindingPoint != static_cast<int>(nBindingPoint)) { // Associate the uniform block with the given binding point m_nBindingPoint = nBindingPoint; glUniformBlockBinding(m_nOpenGLProgram, m_nUniformBlockIndex, m_nBindingPoint); } // Done return true; }
void opengl_array_state::BindUniformBufferBindingIndex(GLuint id, GLuint index) { if ( !GLAD_GL_ARB_uniform_buffer_object ) { return; } if ( uniform_buffer_index_bindings[index] == id ) { return; } glBindBufferBaseEXT(GL_UNIFORM_BUFFER, index, id); uniform_buffer_index_bindings[index] = id; }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTransformFeedback_glBindBufferBaseEXT(JNIEnv *__env, jclass clazz, jint target, jint index, jint buffer) { glBindBufferBaseEXTPROC glBindBufferBaseEXT = (glBindBufferBaseEXTPROC)tlsGetFunction(1827); UNUSED_PARAM(clazz) glBindBufferBaseEXT(target, index, buffer); }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTransformFeedback_nglBindBufferBaseEXT(JNIEnv *env, jclass clazz, jint target, jint index, jint buffer, jlong function_pointer) { glBindBufferBaseEXTPROC glBindBufferBaseEXT = (glBindBufferBaseEXTPROC)((intptr_t)function_pointer); glBindBufferBaseEXT(target, index, buffer); }