PDA

View Full Version : glBufferData and C++ vectors



richman.feynard
07-26-2017, 01:45 PM
I didn't find this in internet, but was wondering what is the necessary and sufficient condition for a data format to pass into glBufferData? Obviously, I can't use any class and any random datatype representing points or vectors, however I've seen how different structures and arrays were passed to it and it worked.

I'm currently trying to write some basic vector and matrix classes in C++ to use it within OpenGL program, and since there are a lot of options, how one can do this, I was interested, what are, kind of, "the best practices", how to do it better?

Thanks to everyone!

GClements
07-26-2017, 04:52 PM
what is the necessary and sufficient condition for a data format to pass into glBufferData?
There are no restrictions on what you can store in a buffer object. But there's not much point in storing data in a buffer object unless it's going to be read by the GPU, which means that it has to be in the format the GPU will be expecting.

For uniform buffers and shader storage buffers, see the GLSL specification. For other buffer types, see the main OpenGL specification.

richman.feynard
07-27-2017, 06:38 AM
Thank you, that's exactly what I looked for.