Sign in to follow this  
Grafalgar

Converting 2D virtual coords to actual screen coords

Recommended Posts

Hi all, I have a custom GUI that I have been tinkering with. To make things 'simple' I have my GUI operate in a virtual resolution. That is to say, regardless of actual screen resolution my GUI -always- operates in an assumed 1024x768 2D resolution. Mapping from GUI coordinates to actual coordinate is trivial math. The problem comes in when my game runs in resolutions other than the GUI virtual resolution. For example, if my game runs in 800x600, some of my sprites have blurry edges, or look a pixel thinner/thicker than what you'd expect them to be. It's ESPECIALLY evident when rendering text. I also know exactly why this happens. Pixels in 1024x768 remapped to 800x600 may overlap more than one pixel when the conversion is complete. Similarly, 1024x768 to 1280x1024 may sometimes result in 'seams' and blurred edges as well. How can I get around this problem? Or is there an entirely different way of handling this? I'd like my GUI to function independant of actual screen resolution, but I'm not sure how get remap the coordinates 'cleanly.' Any help would be very much appreciated :) Grafalgar.

Share this post


Link to post
Share on other sites
The problem is that the texture rasterizer is doing its usual filtering, and for a GUI that requires lots of distinct edges for text and sprites it simply looks bad. The best solution is to have multiple versions of your sprite resources for different resolutions. While this is a bit more work, there really isn't any other good way to get around the limitations of the texture filtering.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this