Passing dynamic arrays into C.

bearophile bearophileHUGS at lycos.com
Sun Apr 25 02:54:10 PDT 2010


Bernard Helyer:
>      glBufferData(GL_ARRAY_BUFFER, vertices.sizeof,
>                   vertices.ptr, GL_STATIC_DRAW);
> 
>      glVertexPointer(2, GL_FLOAT, GLfloat.sizeof * 2, cast(void*)0);

Are you sure that vertices.sizeof is right? It can be wrong. Maybe you want something like:
(vertices[0]).sizeof * vertices.length

That: cast(void*)0
is better written:
null

The sizeof of a dynamic array is 2 CPU words.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list