I feel like I'm misunderstanding how to work with vector/fragment shaders. My vector shader is as follows:
uniform mat4 uVMatrix; // view (camera transformations)
uniform mat4 uMMatrix; // model (object transformations)
uniform mat4 uPMatrix; // projection
attribute vec4 aVertexPosition; // passed in
attribute vec4 aVertexColor;
varying vec4 vColor;
void main() {
gl_Position = uPMatrix * uVMatrix * uMMatrix * aVertexPosition;
vColor = aVertexColor; // pass the vertex's color to the fragment shader
}
Pretty simple. Right now I just have a simple square that I'm transforming in 3D space and drawing. I want to make a see through circle in the middle of the suqare as follows:
This square has 4 vertices that I transform in the vector shader. Here's my fragment shader:
precision mediump float; // how precise to be with floats
varying vec4 vColor; // interpolated from the vertices
void main() {
gl_FragColor = vColor;
}
Now, I've seen I have access to gl_FragCoord, but that coordinate is after all the vector transformations, right? How can I manipulate the pixels in the square, before all the projection transformations, etc.? I don't think I can do it in the vector shader, as there's only 4 vectors...