-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
RenderModel_TextureMap_(packed_)t Incorrect data types in C# #638
Comments
This is to wrap the following C structure which uses uint16_t for width and height: char in C# is 16-bits (as opposed to 8-bits in C). I'm not sure why it was used rather than ushort. |
It should work in theory, but without changing the values to ushort i got incorrect texture sizes. Is it possible that I may have loaded it wrong? |
The problem is actually the Interop Marshall PtrToStructure method. When converting between safe and unsafe code, char fields are converted to/from 1 byte chars, by default. Adding a CharSet attribute to the structure should also work. (Although I prefer changing the field to ushort) https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.charset(v=vs.110).aspx |
Issue ValveSoftware#638: Fixed C# TextureMap field types
Waiting for this to be fixed. It's been 9 months now. |
The current implementation of the 2 strucures in openvr_api.cs is:
Where, according to the docs, the fields unWidth and unHeight are supposed to be ushort.
Manually changing these in the file solves a problem with Render Model Texture Loading.
(Example: with the non midified structures, loading the model vr_controller_vive_1_5 returns a 0x8 px texture.)
The text was updated successfully, but these errors were encountered: