Re: Passing dynamic arrays into C.

2010-04-25 Thread Bernard Helyer
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

Re: Passing dynamic arrays into C.

2010-04-25 Thread Bernard Helyer
Ah, thank you! The problem was I read the way T[].sizeof behaves on static arrays, thinking I was reading the section on dynamic array properties. On 25/04/10 21:52, Daniel Murphy wrote: It should work if you treat the dynamic array like a pointer and a length. eg: glBufferData(GL_ARRAY_BUFFE

Re: Passing dynamic arrays into C.

2010-04-25 Thread Daniel Murphy
It should work if you treat the dynamic array like a pointer and a length. eg: glBufferData(GL_ARRAY_BUFFER, (vertices[0]).sizeof * vertices.length, vertices.ptr, GL_STATIC_DRAW); It's probably because (type).sizeof gives the number of bytes to hold the type. For dynamic arrays

Re: Passing dynamic arrays into C.

2010-04-25 Thread bearophile
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[