On Wednesday, 3 June 2015 at 10:28:50 UTC, Marc Schütz wrote:

A string (or any other array slice for that matter) is internally the equivalent of:

    struct Slice(T) {
        T* ptr;
        size_t length;
    }

(maybe the order of fields is different, I never remember that part)

`&source` will give you the address of that structure.

hmm I still a bit confused..

So in "const char* sources = source.ptr;" sources is just turning the property ptr of source into a variable, and then in glShaderSource you're passing the memory address of sources (which is technically source.ptr) to the function?

Do I have that right? If I do, then I think this all makes sense

Reply via email to