opengl: fix loading shader with preamble that uses #version

The preamble was inserted into a false position so the shader
could was constructed incorrectly and would fail to compile.

Change-Id: I4c51adde9014a326bbe38a5d2d17dd0047e33195
This commit is contained in:
Tomaž Vajngerl 2016-03-06 23:54:52 +01:00
parent 7295729574
commit ed51d4293d

View File

@ -157,8 +157,8 @@ static void addPreamble(OString& rShaderSource, const OString& rPreamble)
if (nVersionStrEndPos == -1)
nVersionStrEndPos = nVersionStrStartPos + 8;
OString aVersionLine = rShaderSource.copy(0, nVersionStrEndPos - nVersionStrStartPos);
OString aShaderBody = rShaderSource.copy(nVersionStrEndPos - nVersionStrStartPos);
OString aVersionLine = rShaderSource.copy(0, nVersionStrEndPos);
OString aShaderBody = rShaderSource.copy(nVersionStrEndPos + 1);
rShaderSource = aVersionLine + "\n" + rPreamble + "\n" + aShaderBody;
}