-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gl.Get return IntPtr? #103
Comments
Yes, it is possible; the code generator supports unsafe and generic overloads.
So I can write:
Or, if you prefer
However, I cannot find a good reason to support Be aware of #98. I cannot reproduce the issue -.-, everything is working correctly on my machine (TM).
This will not happen. OpenGL.Net is decoupled by all data structures not directly related to the OpenGL & Co. API. Personally, I use |
Ah, great, thanks for the reply. Excuse my naivety, haven't fully explored the API and somehow missed the generic overload. As for the System.Numerics, have not yet checked out OpenGL.Net.Math, am guessing I probably should instead of using System.Numerics. I really don't care have no reason to use System.Numerics if the math library supports vectors, matrices, etc. That was the bottom-line request I suppose, not necessarily actual "System.Numerics", but the integrated types for vectors, etc, as opposed to arrays of floats, which are not as intuitive, and didn't want to have to reinvent the wheel just to use them. Sorry about the noobiness, recently started learning OpenGL, and just graduated from old-school fixed pipeline to vertex buffers, etc, to give you clue of my inexperience, lol. Anyways, thanks again, greatly appreciated! |
Don't worry. The wiki should cover the essential for starting with this library. |
This is an enhancement request, not a bug report.
Was wondering if it would be possible to expose a public version of the the Get method to simply return an IntPtr (and/or even an unsafe pointer variation). This would eliminate the need for casting to custom data types.
For example, I commonly use System.Numerics, and find using the Matrix4x4 structure more intuitive than working with an array of floats. As it is (as far as I can see), I am forced to get it as an array first, then if I would like it as a Matrix4x4, either create a whole new structure and use the array values (bad), or pin the float and Marshal a Matrix4x4 from its address (still bad).
I think it would be far more intuitive simply to get a pointer and Marshal to it directly, skipping the middle conversions and copies.
Ideally, I would like to see someday the inclusion of System.Numerics directly in the API (I think it would break support for older framework versions at this point in time), but would be very happy to at least see the inclusion of simply getting a pointer, and be able to Marshal data in any way I see fit.
The text was updated successfully, but these errors were encountered: