gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Translating mouse coords to opengl world space?

#174874 - GeneralFOL - Tue Jul 27, 2010 7:49 pm

Is this done with gluUnProject or is this function not supported by the DS?.

Iain

#174876 - relminator - Wed Jul 28, 2010 10:13 am

There's an example of gl picking at the examples folder.
_________________
http://rel.betterwebber.com

#174884 - GeneralFOL - Wed Jul 28, 2010 11:26 pm

Thanks, will check it out.

#174924 - GeneralFOL - Wed Aug 04, 2010 12:07 am

Checked out the example thanks, but i dont seem to be able to get it working with my code, i simply want to be able to click somewhere on the touch screen and then have a cube moved to that position, but i must be going wrong somewhere as the cube is never drawn there, it only flashes around randomly.

I must be going wrong with my math in changing the 2d viewport coords to the 3d world space ones, can anyone give me a simple example of the math for this?

It will be very much appreciated.

#174927 - kusma - Wed Aug 04, 2010 1:18 pm

Picking and unprojecting is not the same thing. What you seem to want is unprojecting.

#174928 - GeneralFOL - Wed Aug 04, 2010 1:21 pm

Hi, thanks for the reply, yes i do think it is unprojecting, but am i right in thinking that this isnt supported by the ds implementation of opengl?

#174929 - kusma - Wed Aug 04, 2010 1:37 pm

GeneralFOL wrote:
Hi, thanks for the reply, yes i do think it is unprojecting, but am i right in thinking that this isnt supported by the ds implementation of opengl?


There is no DS implementation of OpenGL. NitroGL (as shipped as a part of libnds) is an API that resembles OpenGL, but it does not support for gluUnProject(). You can implement it yourself, though -- there's an example implementation at the OpenGL Wiki.

#174930 - GeneralFOL - Wed Aug 04, 2010 1:39 pm

Great, thanks for the info.