Passing Data through OpenGL API
Well I've just been thinking about some implementation details lately and how data is passed through the OpenGL API. Well most math API and such define a vector (including GLM), at least a simplified version of such, like so:
float x, y, z;
// to pass to OpenGL
glSomeFunction( &v );
glSomeFunction( &v.x );
// basically how it's done in glm
Which, I guess depending on OpenGL implementation, though I think I've read in some documentation that the API expects an array. Passing a structure as an array is undefined behavior in C and C++. I mean GLM works on several compilers and the behavior seems to be similar in each case. Not sure if there is any that can shed some light on this situation, it seems to be 2 or more specification of C/C++ simply imply this to happen even if the specification doesn't explicitly define it as a rule.