
Glu.UnProject replacement for OpenTK.Math
Posted Friday, 23 October, 2009 - 14:51 by JTalton| Project: | The Open Toolkit library |
| Version: | 1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | confirmed |
Jump to:
Description
While Glu support has been marked deprecated and moved to OpenTK.Compatability, the replacement OpenTK.Math does not have a UnProject function.


Comments
#1
Function definition (we can do better):
Probably belongs to MathHelper class.
#2
Any idea when this feature may be added to the OpenTK release? Thank you...
#3
Unless someone posts a patch, I'd guess soon after opentk-1.0-final is out.
#4
#5
Thanks, I will add this to trunk.
#6
Small inaccuracy ...
#7
After two year in the last version not found unproject and project functions in OpenTK.
in this post I found UnProject function ok but I not have skill for create a Project function.
Do you can help me?
#8
If you want to project, just use Vector4.Transform. Anyways, if you want a C# implementation of UnProject to include in MathHelper or whatever:
#9
thank you Robmaister for Unproject function in c# but I don't understand how to use vector4.transform for Project function
#10
ok I found the way:
public static Vector4 Project(OpenTK.Vector4 objPos, Matrix4 projection, Matrix4 view, Size viewport)
{
Vector4 vec = objPos;
vec = Vector4.Transform(vec, Matrix4.Mult(projection, view));
vec.X = (vec.X + 1) * (viewport.Width / 2);
vec.Y = (vec.Y + 1) * (viewport.Height / 2);
return vec;
}