prosperon/shaders/poly_ssbo.cg

37 lines
423 B
Plaintext

#depth off
#blend mix
#primitive triangle
#cull none
@vs vs
in vec3 a_pos;
uniform mat4 vp;
out vec4 shade;
struct poly {
mat4 model;
vec4 color;
};
readonly buffer ssbo {
poly polys[];
};
void main() {
poly p = polys[gl_InstanceIndex];
gl_Position = vp * p.model * vec4(a_pos, 1);
shade = p.color;
}
@end
@fs fs
in vec4 shade;
out vec4 color;
void main() {
color = shade;
}
@end
@program sprite vs fs