PDA

View Full Version : Ray Picking base DX8.X and OpenGL



Herbert
04-23-2003, 06:05 AM
Hi!
I am working on developing a 3D rendering engine base both DirectX8.0 and OpenGL,which allow user to select between the two 3D API. I am programing on Win2K+VC++6.0 environment.Now I want to implement ray picking objects by mouse and the objects would be transformed in world space.I known there is a sample about Ray Picking with Object Transformations,following:
http://www.mvps.org/directx/articles/improved_ray_picking.htm

But I don't known how I can implement same function base OpenGL because there is no independent world and view transformation matrix can be get.Can anybody give me some hints about this?The key problem I want to solve is how to convert 2D mouse to a 3D ray.
Then I can test intersection between the objects of scene and the ray and determine the selected objects.

Thanks in advance
Best Regards
Herbert

deadalive
04-23-2003, 06:42 AM
OpenGL has "picking" commands that might be easier (and faster?) than trying to do what you suggest. But I really have no idea since I'm fairly new to this. GameTutorials.com has some demos that show how to test for collisons, but I don't know if those will help you.