
T2 structure
Posted Wednesday, 10 June, 2009 - 14:08 by Soundbomber inI have just changed to version 0.9.8 and am having a couple of problems.
When passing data to my buffers the BufferData command which worked fine before is throwing errors.
oGL.BufferData(BufferTarget.ArrayBuffer, oObject.oSolidVertices.Length * 12 * _ Marshal.SizeOf(GetType(UInteger)), oObject.oSolidVertices, BufferUsageHint.DynamicDraw)
The data argument seems to be expecting data in the T2 structure format.
What is the T2 structure? I am currently passing in a custom Vertex structure - can I still do this?


Comments
Re: T2 structure
Yes, as long as Vertex is a struct, not a class:
You can either pass a reference to a single struct or arrays of structures. How is oObject.SolidVertices defined?
Re: T2 structure
Re: T2 structure
Is this for VBO objects..? I'm new to these, do you have to declare you own structure to use them properly?
Re: T2 structure
Yes I'm using VBO's. As far as I am aware you can use any custom structure as long as you set the pointers correctly. I have been using this method successfully in v 0.9.5.
Re: T2 structure
Thanks. I'll be asking you for guidence when I come to the point of using VBOs in my "Builder"-object idea.
Re: T2 structure
I'm still new to OpenGL, but I will gladly assist if I can. It has been a (sometimes) painful learning curve getting to grips with VBO's and OpenGL in general (not having any experience in 3D graphics), but well worth it.
Re: T2 structure
Your code should work. What is the error message?
T2 is the name of a generic parameter - the compiler should infer that the actual type is Vertex. This should not be necessary, but you can try to write:
Re: T2 structure
Using (Of Vertex) for the ArrayBuffer and (Of UShort) for the ElementArrayBuffer did the trick.
I also had to declare the size as an IntPtr object first and then pass that into the argument thus:
Thank you for the help.