Game Development Community

Retrieving Mouse Coordinates

by Martin Banks · in Torque 3D Professional · 01/29/2010 (4:45 pm) · 1 replies

I want to retrieve mouse coordinates, convert them to screen coordinates, and pass them to a pixel shader every frame. How can I do this?

#1
01/30/2010 (1:05 pm)
You can pull the mouse coords from guiCanvas or GameTSCtrl - I think the are several resources for object selection that show the same idea.
You will receive these coordinates in pixels and you will have to divide them with the screen area in order to have values in [0,1] range.

processedShaderMaterial.cpp is a good place to set shader constants.