Bind a shader program
| 929 | |
| 930 | // Bind a shader program |
| 931 | void Shaders::setProgram(int which) { |
| 932 | if (which == -1) { |
| 933 | noProgram(); |
| 934 | return; |
| 935 | } |
| 936 | if (bound_program == which) return; |
| 937 | CHECK_GL_ERROR(); |
| 938 | if (programs[which].gl_program == UNLOADED_SHADER_ID) { |
| 939 | if (create_program_warning) { |
| 940 | LOGW << "Loading shader which should be preloaded. " << level_path.GetOriginalPath() << ": " << programs[which].name << std::endl; |
| 941 | } |
| 942 | createProgram(which); |
| 943 | } |
| 944 | glUseProgram(programs[which].gl_program); |
| 945 | Textures::Instance()->InvalidateBindCache(); |
| 946 | bound_program = which; |
| 947 | CHECK_GL_ERROR(); |
| 948 | } |
| 949 | |
| 950 | // Stop using shaders |
| 951 | void Shaders::noProgram() { |
no test coverage detected