I’ve started reading about shaders. Â Ends up there’s a whole extra programming language, “openGL Shading Language”, even beyond what’s basically a programming language embedded in function calls in normal openGL. Â Fortunately the syntax is mostly a subset of C.
But it can be confusing.  So, some variables can be of the “varying” type.  This is for when you want to pass data from a vertex shader to a fragment shader (It hasn’t yet explained why you’d want to do that, or what a fragment shader really is, which is part of the problem. As far as I can tell actual “shading” is probably not involved.).  But apparently values can be a little different each time you run something due to order of execution. So if your program for some reason requires that it be exactly the same for a variable, you can label that variable “invariant.”  And things can be both invariant and variable.  And something else on top of that, sometimes.  So you can have, and it seriously gives this as an example, a “invariant centroid varying vec3 Color;” variable declaration.
It’s weird, you pass the entire shader program text to be compiled in as an argument to an opengl function which compiles it for you, and gives you a handle on the program that results. Â So you’re compiling all this stuff, at runtime. Â At least, the first time through.
-
Recent Posts
Recent Comments
- Alex on Planet data: More flexibility
- Richard on Planet data: More flexibility
Archives
Categories
Meta