c++ - OpenGL Uniform Functions - Why so many? -
why there many functions set uniforms?
gluniform1f gluniform2f gluniform3f gluniform4f gluniform1fv gluniform2fv gluniform3fv gluniform4fv gluniform1i gluniform2i gluniform3i gluniform4i gluniform1iv gluniform2iv gluniform3iv gluniform4iv gluniform1ui gluniform2ui gluniform3ui gluniform4ui gluniform1uiv gluniform2uiv gluniform3uiv gluniform4uiv gluniformmatrix2fv gluniformmatrix2x3fv gluniformmatrix2x4fv gluniformmatrix3fv gluniformmatrix3x2fv gluniformmatrix3x4fv gluniformmatrix4fv gluniformmatrix4x2fv gluniformmatrix4x3fv
i think way data uploaded vertex , element buffers waaay better, since don't have call different function different type. why case uniforms? there possibility use 1 function, can pass pointer?
hindsight 20/20 , choice done in line other functions take vectorial data in various types , dimensionality. i'm referring glvertex… of course. initial reason pass value was, on architectures there enough registers around more efficient pass value in register. compilers optimize preceding operations end right values in right register.
opengl descendant of irixgl developed sgi graphics workstations , irix os. these workstations used mips architecture. , calling convention mips (https://en.wikipedia.org/wiki/calling_convention#mips)
the commonly used[5] calling convention 32 bit mips o32[6] abi passes first 4 arguments function in registers $a0-$a3; …
…
the n32 , n64 abis pass first 8 arguments function in registers $a0-$a7; …
so there have it: on mips it's quite sensible choice pass vec4 elements per value. in irixgl , opengl-1.0 there no vertex arrays , you'd have make lots of glvertex calls.
Comments
Post a Comment