SFML community forums
Help => Graphics => Topic started by: Felheart on February 29, 2012, 04:10:54 pm
-
(http://i.imgur.com/uLTyk.png)
In the bottom example I commented out the scaling and changed the font size from 20 to 10 to maintain the size.
So scaling the text down resolves the issue.
No changes to View or any other transformations have been made.
Is it advised to always scale down the text when rendering?
Is this intended? Is there some better way to fix this?
Using the .NET bindings in C# if that matters.
-
Strange, the best result is supposed to be obtained by changing the character size, scaling should make things a little blurry. And you get the opposite.
-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFML.Window;
using SFML.Graphics;
using System.IO;
using System.Diagnostics;
namespace SFML_Test3
{
static class Program
{
static RenderWindow renderWindow;
static void Main(string[] args)
{
renderWindow = new RenderWindow(new VideoMode(800, 500), "SFML 2", Styles.Default, new ContextSettings(32, 0, 16));
renderWindow.Show(true);
renderWindow.ShowMouseCursor(true);
renderWindow.SetFramerateLimit(60);
renderWindow.Closed += (s, e) => { Environment.Exit(0); };
renderWindow.Resized += (s, e) => { renderWindow.SetView(new View(new FloatRect(0, 0, e.Width, e.Height))); };
Font debugFont = new Font(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "visitor1.ttf"));
Text debugText1 = new Text("TEST1", debugFont, 10);
Text debugText2 = new Text("TEST2", debugFont, 20);
debugText2.Scale = new Vector2f(0.5f, 0.5f);
while (renderWindow.IsOpen())
{
renderWindow.DispatchEvents();
renderWindow.Clear();
//
debugText1.Position = new Vector2f(50, 50);
debugText2.Position = new Vector2f(50, 80);
renderWindow.Draw(debugText1);
renderWindow.Draw(debugText2);
//
renderWindow.Display();
}
}
}
}
Font used is this one:
http://www.dafont.com/visitor.font
there are 2 versions, obviously (from looking at the source) I am using visitor1
I'm getting similar results for all other fonts too.
EDIT:
I just noticed that changing: new ContextSettings(32, 0, 16);
to
new ContextSettings(32, 0, 8)); // 8 or lower
resolves the problem, the question remains... why ?
When I use (for example) Arial and antialiasing == 0, it's like you said, the first result looks better.
Does that mean that I shouldn't use antialiasing:16 or is it some kind of bug?
-
Does that mean that I shouldn't use antialiasing:16 or is it some kind of bug?
I don't think it's a bug in SFML. I don't know why the results are this way with antialiasing x16, but this is how your graphics driver behaves.