I've never used GLSL but a simple search using Google came up with the 3 websites I use when using plain old OpenGL. Seems as good a place as any.
Lerner
Nearly a Posting Maven
2,408 posts since Jul 2005
Reputation Points: 739
Solved Threads: 406
Skill Endorsements: 9
You also should take a look at Shader Designer. This is an IDE for GLSL, I've used it in the past when I played around with shaders, it's pretty nice and easy. I think it also provides base codes to start from.
mike_2000_17
21st Century Viking
3,167 posts since Jul 2010
Reputation Points: 2,082
Solved Threads: 637
Skill Endorsements: 42
I first use a shader to create a texture, correct?
No. Shaders are used to transform texture(s), at least, fragment shaders do that. Shaders are basically small programs that run on the GPU. A vertex shader is a small program that runs for each vertex (point in a 3D mesh) that you render, and its job is to apply whatever transformations are necessary to prepare it to be rendered on the screen (these transformations include projecting it into a point on the screen, and other things like computing its texture coordinates, applying a bump-map to it, or even animating the vertex). After vertices are projected to a place on the screen, the OpenGL pipeline generates a number of pixels on those surfaces that should appear on the screen. The fragment shader is a small program that takes each pixel (or fragment) and performs a final transformation of the values associated to the pixel, that can include applying lighting, blending the pixel color coming from different textures, and possibly generating colors too, even animating them, and I think that's what you are asked to do.
And then I have it change colors based on a certain time?
Yes, shaders have a number of inputs, some that are fixed by OpenGL, and some that you can customize. You can use Uniforms (see glUniform) which are like constant parameters, and Attibutes (see glVertexAttrib) which are per-vertex values. The inputs that are fixed by OpenGL include the coordinate of the pixel on the screen and its depth, the color value, the texture coordinates, the textures themselves, and some other things. The job of the fragment shader is to take all or any of that and produce a color value to be put on the screen, and you can produce that color value any way you like, including as a function of time, including a blend of textures, etc.
How would I deal with coordinates?
You get them as inputs to the shader program. OpenGL takes care of it for you, all you have to worry about is how to use the coordinates to affect the pixel color, if that's something you want to do.
mike_2000_17
21st Century Viking
3,167 posts since Jul 2010
Reputation Points: 2,082
Solved Threads: 637
Skill Endorsements: 42
Question Answered as of 1 Year Ago by
mike_2000_17,
Lerner
and
BobS0327