views:

117

answers:

1

I have multiple input devices and I want to create a cursor for each one. I'm given x and y coordinates, and I want to draw it on the screen.

How do I calculate the x,y when using glTranslatef?

+1  A: 

I'm pretty sure, unless im suffering from a major mind failure, it goes as follows:

float fX  = ((float)(x * 2) / (float)screenWidth) - 1.0f)
float fY  = ((float)(-y * 2) / (float)screenHeight) - 1.0f)
Goz
hi yup it works :) thank you so muchalthough it should befloat fY = (((float)(y * 2) / (float)screenHeight) - 1.0f)*-1.0f;
PCBEEF
yeah fair enough .. I had a feeling i was getting the reverse on the y-axis wrong :)
Goz