
Hi all,
Depending on what you exactly want to achieve, it might be possible to setup your modelview matrix and your projection matrix in such a way that you get a 1:1 mapping between object coordinates and window coordinates, so you don't have to apply the inverses.
I recently struggeled with this issue, the following reshape callback does exactly this. -- | This function is called when the window is resized reshape s@(OpenGL.Size w h) = do -- Make sure that our model coordinates correspond to pixels OpenGL.matrixMode $= OpenGL.Projection OpenGL.loadIdentity OpenGL.ortho 0 (fromIntegral w) 0 (fromIntegral h) 0 1 -- Do something funky with the viewport OpenGL.viewport $= (OpenGL.Position 0 0, s) I'm not 100% confident about the final 0 and 1 arguments (which specify the bounds on the depth axis, but it works like this (specifying 0 0 didn't work and made the last line be silently ignored!). Alternatively, you could probably set up the projection matrix such that the model coordinates always range from -1 to 1 in both directions. IIRC that is what happens when uinsg only identity matrices and is the default, but I'm not 100% sure. In any case, you always need to set the viewport, AFAIU. Gr. Matthijs