JohnLaird
Well-Known Member
Trying to wrap my head around fragment shader programming in OpenGL ES2 for WebGL. Slow going...I have a psychedelic quadrilateral rotating on the screen...
var VSHADER_SOURCE =
'attribute vec4 a_Position;\n' +
'attribute vec4 a_Color;\n' +
'uniform mat4 u_ModelMatrix;\n' +
'varying vec4 v_Color;\n' +
'void main() {\n' +
' gl_Position = u_ModelMatrix * a_Position;\n' +
' v_Color = a_Color;\n' +
'}\n';
var FSHADER_SOURCE =
'precision mediump float;\n' +
'varying vec4 v_Color;\n' +
'void main() {\n' +
' gl_FragColor = v_Color;\n' +
'}\n';
Now on to procedural textures...I want to take apart this...
glsl - OpenGL ES 2.0 Shader - 2D Radial Gradient in Polygon - Stack Overflow
and make it so the only fragments that pass through are in the radial gradient. So that there is a fading circular colors. Maybe I should go to sleep though...all this stuff does is make me feel dumb.
var VSHADER_SOURCE =
'attribute vec4 a_Position;\n' +
'attribute vec4 a_Color;\n' +
'uniform mat4 u_ModelMatrix;\n' +
'varying vec4 v_Color;\n' +
'void main() {\n' +
' gl_Position = u_ModelMatrix * a_Position;\n' +
' v_Color = a_Color;\n' +
'}\n';
var FSHADER_SOURCE =
'precision mediump float;\n' +
'varying vec4 v_Color;\n' +
'void main() {\n' +
' gl_FragColor = v_Color;\n' +
'}\n';
Now on to procedural textures...I want to take apart this...
glsl - OpenGL ES 2.0 Shader - 2D Radial Gradient in Polygon - Stack Overflow
and make it so the only fragments that pass through are in the radial gradient. So that there is a fading circular colors. Maybe I should go to sleep though...all this stuff does is make me feel dumb.