Derelict2 openGL3 issues
Stephen Jones
siwenjo at gmail.com
Sat Apr 21 14:49:14 PDT 2012
On Saturday, 21 April 2012 at 11:02:51 UTC, David wrote:
> glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, null);//is
> this right casting a void pointer for 0 offset?
>
>
> I do it like this: cast(void*)OFFSET; e.g.
> cast(void*)12;
Thankyou David. Just to complete the code for those who follow:
it works if you change the above as follows:
glBufferData(GL_ARRAY_BUFFER, v.length * GL_FLOAT.sizeof, &v,
GL_STATIC_DRAW);
to:
glBufferData(GL_ARRAY_BUFFER, v.length * GL_FLOAT.sizeof, &v[0],
GL_STATIC_DRAW);
The null value in:
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, null);
can be replaced with cast(void*)0 as David suggests, but the code
runs either way.
I don't quite understand the sizeof comment as
writeln(GL_FLOAT.sizeof) gives me 4 which is what I expect.
Although this is not the place for it, I would just like to plug
Pelles C ide:
http://my.opera.com/run3/blog/2012/02/09/d-programming-in-pelles-c
Simple to set up.
More information about the Digitalmars-d-learn
mailing list