Monday, August 3, 2015

c++ - How can I keep a GUI on-screen without moving/resizing it according to camera motion?


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)?



Answer



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.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...