oculus2_psprite
view sdr/psprite.v.glsl @ 23:fe9600396f65
fixed visual studio project
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 22 Jan 2015 14:03:24 +0200 |
parents | |
children |
line source
1 uniform vec2 viewport;
3 void main()
4 {
5 const float psize = 1.0;
7 vec4 ppos = gl_ModelViewProjectionMatrix * gl_Vertex;
8 gl_Position = ppos;
10 float vs_z = (gl_ModelViewMatrix * gl_Vertex).z;
11 vec4 p0 = gl_ProjectionMatrix * vec4(0.0, 0.0, vs_z, 1.0);
12 vec4 p1 = gl_ProjectionMatrix * vec4(psize, 0.0, vs_z, 1.0);
14 p0.xyz /= p0.w;
15 p1.xyz /= p1.w;
17 p0.xy = (p0.xy * vec2(0.5, 0.5) + vec2(0.5, 0.5)) * viewport;
18 p1.xy = (p1.xy * vec2(0.5, 0.5) + vec2(0.5, 0.5)) * viewport;
20 float sz = length(p1.xy - p0.xy);
21 gl_PointSize = sz;
22 }