
Help with syntax in VB.net for types and pointers
Posted Tuesday, 1 June, 2010 - 07:23 by Norris inHi !
First, sorry for my bad english.
I'm a little programmer and I don't know C or C++ language. So, I prefer VB to C# and try to understand how OpenTK works. That's very cool!
But I find hard converting C# syntax for some code about pointers or "sizeof" since I dont know C++.
I can easily showing a cube or loading vertices for showing a point cloud (from scanner) ... but that's in direct mode. I have read that's deprecated and no longer exists in future OpenGL versions. I have understand that I must use VBO and IBO. So, I try to implement the code from tutorial on this page.
http://www.opentk.com/doc/chapter/2/opengl/geometry/vbo
I can read this:
(IntPtr) ( Vertices.Length * 8 * sizeof( float ) )
I can understand a little of the concept, but can't make an equivalent in VB.Net


Comments
Re: Help with syntax in VB.net for types and pointers
Look here.
Re: Help with syntax in VB.net for types and pointers
Thanks for your link. I have spent more time and I successfully make VBO working under C#, but I tried to convert my project with SharpDevelop and I have only one error that I can't repair.
That's about .... BlittableValueType.StrideOf(vertices)
This is for the GL.BufferData function. I don't very understand this unmanaged world, but, isn't it the same as get the "size" ... the same as the Marshall.SizeOf ???
This is more code with error:
Thanks for your help for a newbie in the real world of programmers :D
Re: Help with syntax in VB.net for types and pointers
You can compile your code in C# and open the generated .exe with Reflector. With this tool you can convert any .Net assembly to C#, VB.Net and so on...
Re: Help with syntax in VB.net for types and pointers
Thanks for your link. I have spent more time and I successfully make VBO working under C#, but I tried to convert my project with SharpDevelop and I have only one error that I can't repair.
That's about .... BlittableValueType.StrideOf(vertices)
This is for the GL.BufferData function. I don't very understand this unmanaged world, but, isn't it the same as get the "size" ... the same as the Marshall.SizeOf ???
BlittableValueType.StrideOf()is the same asMarshal.SizeOf, only faster (the latter evaluates the size every time, while the former caches the value and returns it instantly).You can construct an IntPtr directly, no need to cast:
(In this case, the IntPtr is not used as pointer but rather as a "native int" type to match what OpenGL expects).
What error are you getting?