MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / setProgram

Method setProgram

Source/Graphics/shaders.cpp:931–948  ·  view source on GitHub ↗

Bind a shader program

Source from the content-addressed store, hash-verified

929
930// Bind a shader program
931void 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
951void Shaders::noProgram() {

Callers 15

drawVisualizationMethod · 0.80
InitUniformsMethod · 0.80
UpdateMethod · 0.80
AddDecalToTrianglesMethod · 0.80
IgniteMethod · 0.80
ExtinguishMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
CubemapMipChainFunction · 0.80
RenderCubeMapMethod · 0.80
DrawMethod · 0.80

Calls 2

GetOriginalPathMethod · 0.80
InvalidateBindCacheMethod · 0.80

Tested by

no test coverage detected