Jump to content
  • Advertisement
Sign in to follow this  
pcgamer2008

Regarding Crosshair at screen centre

This topic is 2768 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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....

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!