In my cross platform OpenGL application I want to draw using vertex buffer objects. However I run into problems invoking glDrawRangeElements.
glDrawRangeEle
Since it's so commonly used, people frequently use a macro for his type conversion. It can be defined like this:
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
This is a clean and safe way of doing the cast, because it does not make any assumptions about integer and pointer types having the same size, which they often don't on 64-bit systems.
Since I personally prefer C++ style casts, and don't use NULL, I would define it like this:
#define BUFFER_OFFSET(idx) (static_cast(0) + (idx))