CDoubleU's picture

Picking/Selection with OpenTK 1.0 RC1

Hello everybody,

I try to do picking and I found a lot of tutorials how to do this in OpenGL. But unfortunately the GLU functions aren't any longer in OpenTK. And I couldn't figure out how to do this with the existing methods in OpenTK 1.0 RC1.
And by the way: Using the compatibility DLL isn't a possibility for me. I want to know how to simulate the GLU functions.

Thanks in advance
CDoubleU


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
migueltk's picture

You need to check that the result returned by private Matrix4 GluPickMatrix () is correct. To test this I suggest you implement the program using opentk.compatibility (Glu) and see what works. Now, implement the same program using Matrix4 GluPickMatrix () and in debug mode checks the values returned in the matrices match.

Regards, ...

Boogiwoogie's picture

Hi there!
As the picking topic comes up every once in a while, I may put my solution here too?
There is an OpenGL sample implementation of OpenGL available from SGI, and I ported over the project.c file, which holds the gluLookAt, gluProject and gluUnProject functions. I added a ray/triangle intersection test that I have found via google.
It is part of a small immediate mode gui project, you may rename the "Imgui" namespace to your needs.

@Fiddler: As any serious or not-so-serious OpenGL app will sooner or later want to have user input like picking, wouldnt it be nice to have some sort of project/unproject functions included in OpenTK? Ray/triangle intersection may be useful too.
As most other Glu functions like tesselation are far more sophisticated, I dont see the need to port it all over.

AttachmentSize
Glu.cs9.36 KB
tksuoran's picture

Look no further than OpenTK examples. There is a picking example which I think uses ID buffer.