bool ShaderGLES2::bind() { if (active!=this || !version || new_conditional_version.key!=conditional_version.key) { conditional_version=new_conditional_version; version = get_current_version(); } else { return false; } ERR_FAIL_COND_V(!version,false); glUseProgram( version->id ); DEBUG_TEST_ERROR("Use Program"); active=this; uniforms_dirty = true; /* * why on earth is this code here? for (int i=0;i<texunit_pair_count;i++) { glUniform1i(texunit_pairs[i].location, texunit_pairs[i].index); DEBUG_TEST_ERROR("Uniform 1 i"); } */ return true; }
bool ShaderGLES2::bind() { if (active != this || !version || new_conditional_version.key != conditional_version.key) { conditional_version = new_conditional_version; version = get_current_version(); } else { return false; } ERR_FAIL_COND_V(!version, false); if (!version->ok) { //broken, unable to bind (do not throw error, you saw it before already when it failed compilation). glUseProgram(0); return false; } glUseProgram(version->id); // find out uniform names and locations int count; glGetProgramiv(version->id, GL_ACTIVE_UNIFORMS, &count); version->uniform_names.resize(count); for (int i = 0; i < count; i++) { GLchar uniform_name[1024]; int len = 0; GLint size = 0; GLenum type; glGetActiveUniform(version->id, i, 1024, &len, &size, &type, uniform_name); uniform_name[len] = '\0'; String name = String((const char *)uniform_name); version->uniform_names.write[i] = name; } bind_uniforms(); DEBUG_TEST_ERROR("use program"); active = this; uniforms_dirty = true; return true; }
bool ShaderGLES2::bind() { if (active != this || !version || new_conditional_version.key != conditional_version.key) { conditional_version = new_conditional_version; version = get_current_version(); } else { return false; } ERR_FAIL_COND_V(!version, false); glUseProgram(version->id); DEBUG_TEST_ERROR("use program"); active = this; uniforms_dirty = true; return true; }