DRW: Make fullscreen vertex shader position and uv without attributes

This commit is contained in:
Clément Foucault 2019-05-16 14:16:23 +02:00
parent 26beaa2d90
commit 89673f0974
1 changed files with 5 additions and 4 deletions

View File

@ -1,10 +1,11 @@
in vec2 pos;
in vec2 uvs;
out vec4 uvcoordsvar;
void main()
{
uvcoordsvar = vec4(uvs, 0.0, 0.0);
gl_Position = vec4(pos, 1.0, 1.0);
int v = gl_VertexID % 3;
float x = -1.0 + float((v & 1) << 2);
float y = -1.0 + float((v & 2) << 1);
gl_Position = vec4(x, y, 1.0, 1.0);
uvcoordsvar = vec4((gl_Position.xy + 1.0) * 0.5, 0.0, 0.0);
}