Reputation: 991
OS: Win7 VS 2012
Graphics Card: Inter HD 4000
I have no problem generating an image without any computation. However, when I added p*vPosition for a prospective projection, My window opened and closed immediately after I executed the program. Could anyone point out what I have done wrong? My vshsader.glsl code looks like this:
#version 150
in vec4 vPosition;
in vec4 vColor;
out vec4 color;
void main()
{
float d = -10.0;
mat4 p = mat4( 1.0, 0.0, 0.0, 0.0
0.0, 0.0, 1.0, 0.0
0.0, 0.0, 1.0, 0.0
0.0, 0.0, 1/d, 0.0);
gl_Position = p*vPosition;
color = vColor;
}
Upvotes: 0
Views: 138
Reputation: 5449
You are missing commas at the end of each line of parameters to the mat4 constructor.
It should be:
mat4 p = mat4( 1.0, 0.0, 0.0, 0.0, // <- end with comma
0.0, 0.0, 1.0, 0.0, // <- end with comma
0.0, 0.0, 1.0, 0.0, // <- end with comma
0.0, 0.0, 1/d, 0.0);
Upvotes: 3