編輯: 好吧現在得到它:D 問題:完全忘記的glm使用colum-major矩陣。只需要將GL_TRUE更改爲GL_FALSE,一切都可以。GLSL 330矩陣計算錯誤{沒有編譯錯誤}
我試圖計算我ModelMatrix我ProjectionMatrix。像這樣:
#version 330
layout(location = 0) in vec4 position;
layout(location = 1) in vec4 color;
uniform mat4 projectionMatrix; //This are the Matrixes from my cpp-app
uniform mat4 modelMatrix; //With a debugger that can show all active uniforms i checked their values: They're right!
uniform mat4 testUni; //Here I checked if its working when I precompute the model and perspective matrices in my source: works
mat4 viewMatrix = mat4(1.0f);
noperspective out vec4 vertColor;
mat4 MVP = projectionMatrix * modelMatrix ; //Should actually have the same value like testUni
void main()
{
gl_Position = testUni * position ; //Well... :) Works
gl_Position = MVP * position ; //Well... :) Doesn't work [Just the perspective Transforn]
vertColor = position;
}
當你在main()中移動MVP計算會發生什麼?或者讓MVP'const'? – genpfault
const MVP:白色矩形:不起作用 main():與上面相同main()[但沒有const] – BlackCrowned