#version 330 core
layout (location = 0) in vec3 vin;
layout (location = 1) in vec2 vtx;
uniform mat4 MVP;
out float depth;
void main() {
gl_Position = MVP * vec4(vin, 1.0);
// stencil mode
depth = 1;
if(gl_Position.z<-50) {
depth = -1;
}
// depth mode
//depth = gl_Position.z;
//depth = gl_Position.z / gl_Position.w; // Linearize if need
}