Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make a GUI library with SFML, and everything's done except for one problem: making the interface stay still even when the camera moves or zooms in and out.

This would be easy to fix if zooming wasn't possible, but zooming out means having to scale the contents of the interface up so it doesn't shrink, which causes it's text/images to become blurry.

Does anyone have a way to get around this issue (preferably only using SFML as I don't want to make my library OpenGL-dependent)?

share|improve this question
up vote 12 down vote accepted

After you've rendered the world, reset the camera position to something more useful for UIs. Then render the UI. Next frame, put it back to the world position before rendering the world. And so forth.

By "camera position" I really mean "transformation matrix". Nobody says all rendering has to go through the world transformation.

share|improve this answer
+1 the last sentence should read: not all rendering should go through the same view/projection transformation, one can even switch between perspective and orthogonal view in the same render tick – Maik Semder Jul 30 '11 at 10:31
@Maik Semder good point on noting the switch to orthogonal, which is likely to be what the OP needs for a UI. – jv42 Jul 31 '11 at 11:05

In SFML terms, you should be changing the active sf::View on your RenderTarget between rendering the world and the GUI. Your world View should be whatever is most convenient for your world rendering and centered on your player position; your UI View should be pixels or some standard resolution, rooted at the origin.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.