Passing dynamic arrays into C.
b.helyer at gmail.com
Sun Apr 25 04:50:59 PDT 2010
Guilty on all charges. Confused the behaviour of static and dynamic
arrays with sizeof.
On 25/04/10 21:54, bearophile wrote:
> 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).sizeof * vertices.length
> That: cast(void*)0
> is better written:
> The sizeof of a dynamic array is 2 CPU words.
More information about the Digitalmars-d-learn