I'm refering by my trouble to:
The OpenGL Programming Guide: The Official Guide to Learning OpenGL Version 4.3
In the 8th edition
Example 2.4 Initializing Uniform Variables in a Named Uniform Block:
I tryed to compile this Code example, but got compiling errors (as with every example of that book untill now)
After I wasn't able to find anyone else had this problem (what is strange in my eyes after I found the error source by my self), I tryed to figgure out what could be the problem.
memcpy(buffer + offset[Scale], &scale, size[Scale] * TypeSize(type[Scale]));
memcpy(buffer + offset[Translation], &translation, size[Translation] * TypeSize(type[Translation]));
memcpy(buffer + offset[Rotation], &rotation, size[Rotation] * TypeSize(type[Rotation]));
memcpy(buffer + offset[Enabled], &enabled, size[Enabled] * TypeSize(type[Enabled]));
This for lines are causing the error, where buffer is declared as: GLvoid *
.
So my question is:
Why they try to do pointer arithmetic on a void pointer (As I'm guessing, thats what GLvoid *
is)?
And what I probably have to cast it to, that it gets teh right length memcpyed?
as I'm new to openGL and can't get really get the context of that (300 lines) example to get by my self what the GLvoid *
is working with.
Can any one who knows the book, or at least the example tell me what I had to cast the Dst part of memcpy to? Or tell me what else I'm maybe doing wrong and how to solve it?
<header_names>
after the#include
statements... – rubenvb