I’m working with HLSL and GLSL. HLSL has some features that I’d like to use with my GLSL code too. So, I’d like to ask if you have an idea how can I use
[li]Buffer - a data type []Register - used to assign a variable to a particular constant register []Packoffset - used to assign an element to a particular register subcomponent []the #include directive []type casting
I know they are not directly supported by GLSL, so, any idea on how I can work with them are mostly welcome.
For starters you really want to have a gander at the GLSL spec, which covers all the language features quite nicely.
Let’s see, the bindable uniform buffer is the cbuffer counterpart; there’s no register/packoffset equivalent; and there’s an #include mechanism on the way in GL3.
You can cast in GLSL. For example, mat3(some_float) casts a float into a 3x3 matrix (some_float along the diagonal, 0s off the diagonal). Casting matrices to matrices: mat2(some_mat4) gives you the upper 2x2 portion of the 4x4 matrix. mat4(some_mat2) inserts the 2x2 matrix into the upper left of a 4x4 identity matrix. You can cast integers to floats and floats to integers: int(some_float), float(some_int).