Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/libprojectM/Renderer/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ GLuint Shader::CompileShader(const std::string& source, GLenum type)
GLint shaderCompiled{};

auto shader = glCreateShader(type);
const auto *shaderSourceCStr = source.c_str();
const auto* shaderSourceCStr = source.c_str();
glShaderSource(shader, 1, &shaderSourceCStr, nullptr);

glCompileShader(shader);
Expand Down Expand Up @@ -215,6 +215,14 @@ auto Shader::GetShaderLanguageVersion() -> Shader::GlslVersion

std::string shaderLanguageVersionString(shaderLanguageVersion);

// Some OpenGL implementations add non-standard-conforming text in front, e.g. WebGL, which returns "OpenGL ES GLSL ES 3.00 ..."
// Find the first digit and start there.
auto firstDigit = shaderLanguageVersionString.find_first_of("0123456789");
if (firstDigit != std::string::npos && firstDigit != 0)
{
shaderLanguageVersionString = shaderLanguageVersionString.substr(firstDigit);
}

// Cut off the vendor-specific information, if any
auto spacePos = shaderLanguageVersionString.find(' ');
if (spacePos != std::string::npos)
Expand Down