public void SetActiveShader(ShaderProgram shader) { if (shader == null) { Logger.LogError(Logger.ErrorState.Critical, "SetActiveShader, no shader given"); return; } if (activeProgram != shader) { activeProgram = shader; activeProgram.Use(); ShaderUniformManager man = ShaderUniformManager.GetSingleton(); if (man.DoesShaderUseCamera(activeProgram)) { RenderCamera(); } if (man.DoesShaderUseLights(activeProgram)) { RenderActiveLights(); } if (man.DoesShaderSupportUniform(activeProgram, ShaderUniformName.CubeMap)) { MaterialManager matMan = MaterialManager.GetSingleton(); matMan.SetFromMaterialToShader(activeSkybox, ShaderUniformName.CubeMap, activeProgram); if (man.DoesShaderSupportUniform(activeProgram, ShaderUniformName.SkyboxRotationMatrix)) { int rotLoc = activeProgram.GetUniformLocation(ShaderUniformName.SkyboxRotationMatrix); activeProgram.SetMatrix4Uniform(rotLoc, ref activeSkyboxRotation); } } } }