// FRAGMENT
#version 450
layout(location=0) out vec4 colorOut;
//layout(location=1) in float texIdxOut;
//layout(location=3) in vec2 uv;
//uniform sampler2DArray texSampler;
//uniform Block
//{
// vec4 colorIn;
//};
void main()
{
//vec4 color = texture(texSampler,vec3(uv.xy,texIdxOut));
//colorOut = vec4(color.rgba);
colorOut = vec4(0,1,0,1);
}
// VERTEX
#version 450
// vertices
layout(location=0)in vec2 pos;
// offset (position basically)
//layout(location=1)in vec2 offset;
#if 0
// uv
layout(location=2)in vec2 uvIn;
layout(location=5)out vec2 uv;
// texIdx
layout(location=3)in float texIdx;
layout(location=6)out float texIdxOut;
// size
layout(location=4)in vec2 size;
uniform Block
{
// camera
vec2 camera;
// resolution (for scaling from pixels to NDC)
vec2 pixelsToNdc;
};
#endif
vec2 positions[3] = vec2[](
vec2(0.0,-0.5),
vec2(0.5,0.5),
vec2(-0.5,0.5)
);
void main()
{
#if 0
texIdxOut = texIdx;
// set UV
uv = uvIn;
// set size of the object (square only)
vec2 newPos = (pos.xy*(vec2(64,64)*0.5));
//make 0,0 be the Top Left of the object drawn
newPos.xy -= vec2(-64,64)*0.5;
// offset position
newPos += vec2(offset.x,offset.y);
// offset camera
newPos += camera;
// scale to the resolution (so positions can be in pixels)
newPos *= pixelsToNdc;
// make (0,0) Top Left
newPos -= vec2(1,-1);
gl_Position = vec4(newPos,1.0,1.0);
#endif
gl_Position = vec4(pos,1,1);
}