
For example the one from Lighthouse3D is pretty good. Maybe have a google search on "OpenGL GLSL tutorial" or "OpenGL shader tutorial" and you will find good resources on shaders with OpenGL. If you want to perform lighting calculations within your fragment shader, that shader would want to know about the light locations. There is no way around that.īut what you probably meant is whether you should parameterize your shader using uniforms so that it knows where the light sources are. So in general your fragment shader will always perform the same computation on each fragment. I don't understand the intent of your separation between " make the fragment shader universal (same computation for every fragment)" and " using many uniforms".Īs the name " uniform" implies, the value within a uniform stays.,well. Here we come to my question: if I want to make custom lighting, do i have control over that per-pixel-color-generation process? for example, take this game. now there is a conflict: each vertex has a color, Vertex Shader gets vertices, and Fragment Shader gets pixels, then what is done with the vertex's color? from what I've understood, the color is interpolated from varying vertices, and that can be changed using flat or smooth before defining a variable. The Fragment Shader will run on each PIXEL. Then the shapes are Rasterized into pixels.


the vertex Shader performs its operations (translation, zooming and other stuff that i do) and passes the correct vertices to the geometry Shader, which creates the shapes - triangles, lines, you can specify the type it in the glDrawElements function, GL_LINES or GL_TRIANGLES etc.

The vertex Shader's input is directly from the program output: vertices, that could be coming as attribute lists(location color etc.), or interleaved. There are the vertex Shader, fragment Shader and geometry Shader, which I won't use. First i'll describe what I know, and in case i'm wrong, please correct me: I'm new to modern openGL and LWJGL 3, and i have a problem.
