opentk / GLControl

WinForms control for OpenTK 4.x.
https://opentk.net
Other
54 stars 24 forks source link

Vector4.Transform issue #38

Closed OnderCoskun16 closed 7 months ago

OnderCoskun16 commented 8 months ago

Hello I want to take from screen to world coordinate and i have found follow example

Vector4 clipCoordinates = new Vector4(normalizedX, normalizedY, -1.0f, 1.0f); Matrix4 invProjection = Matrix4.Invert(projection); Vector4 eyeCoordinates = Vector4.Transform(clipCoordinates, invProjection); this line has error due to Argument 2: cannot convert from 'OpenTK.Mathematics.Matrix4' to 'OpenTK.Mathematics.Quaternion'

Your library is public static Vector4 Transform(Vector4 vec, Quaternion quat) but all of examples has public static Vector4 Transform(Vector4 vec, Vector4 invprojection)

how can i find a solution this problem? Thank you for interesting

NogginBops commented 8 months ago

What version of GLControl and OpenTK are you using?

OnderCoskun16 commented 8 months ago

PackageReference Include="OpenTK" Version="4.8.1" I tried your example that called name OpenTK.WinForms.InputTest

OnderCoskun16 commented 7 months ago

is there anyone can help the my question?

NogginBops commented 7 months ago

Sorry for the late reply. Not sure where you got example code that contains Vector4.Transform but you are likely looking for Vector4.TransformRow. If there is any resource where we are using Vector4.Transform it would be great if you could tell me where so I can fix that.

NogginBops commented 7 months ago

Please find real examples instead of ones hallucinated by chat gpt. You could ask for support on our discord.

In the code you posted there it seems like the matrix multiplication order is wrong. OpenTK uses row-major matrix conventions where the matrix multiplication order is left to right i.e. vec * matrix instead of matrix * vec. Not sure I understand your question though.