Regarding Crosshair at screen centre

Started by
2 comments, last by Trienco 12 years, 11 months ago
Hello World ! I have a problem regarding placing a crosshair at screen centre...suppose I want a cube(glutSolidCube()) at the screen centre during camera movement...problem is that when I move my camera W-forward S-Backward A-Left D-Right and direction with the help of mouse movement as in PC games.. crosshair(cube) gets affected by model view transformation....It's position at centre gets disturbed....


AS in most PC games, scoreboard is maintained wither on RHS and LHS. During Camera movement and rotation , it remains at its position...how programmers do this...??? Plz help me for crosshair at centre programming....
Advertisement
HUD elements aren't effected by any matrix, just define their screen coordinates.
If u have questions how to implement such behavior in a specific API go to one of the subforums.

take a look at orthogonal projection for example

HUD elements aren't effected by any matrix, just define their screen coordinates.
If u have questions how to implement such behavior in a specific API go to one of the subforums.

take a look at orthogonal projection for example



ortho projection is still using a matrix :)

@ op: the easiest method would be, as Danny02 had mentioned, to store the crosshair coordinates in screen space and use orthographic projection. You could also define your own coordinate system and use a matrix to move from that system to screen space, NDC space, view space, or even world space.
Plz help me for crosshair at centre programming....


By setting the transformation matrix to something else (like the identity)? There is no law in graphics that your entire frame has to be rendered using that one matrix. Keep one thing in mind: there is no camera. Your point of view is ALWAYS at the origin and ALWAYS looking down negative z (or positive, depending on your API). There is no way to "move the camera", all you can do (and the view matrix does) is move the world in the opposite way.

The solution to not having unwanted transformations isn't to apply even more transformations to cancel them out, but not applying them in the first place.
f@dzhttp://festini.device-zero.de

This topic is closed to new replies.

Advertisement