Graphic Corruption with Bilinear Filtering on t2dTextObject
by Harry Durnan · in Torque Game Builder · 04/19/2012 (8:56 pm) · 7 replies
I've been fooling around with the Bilinear Filtering options, and I noticed that in some cases it seems to actually cause increased corruption for t2dTextObject's. Usually it makes the text look smoother, but sometimes it ends up with odd extra lines running through the characters. Anyone know of any engine changes that might fix/improve this? I'm not as familiar with the C++ side of things, or OpenGL, but I have hacked in some engine code changes before?
About the author
Author of It's A Wipe! (http://www.iawgame.com :)
#2
05/02/2012 (11:41 am)
Interesting, I'll give that a try. Any recommendations on a program to create the font files with?
#3
However! While looking around I found this thread that I think will help you a lot: http://www.garagegames.com/community/forums/viewthread/45920
Edit: Had another link but realized it wasn't relevant.
I hope this helps, if I remember anything I'll let you know, good luck!
05/02/2012 (12:57 pm)
It has been a year or so, my memory is very fuzzy. I believe I used Font Boy to make a png of my desired font, then edited that, then ditched Font Boy (due to compatibility issues) and used console methods to import the font. It was a messy process.However! While looking around I found this thread that I think will help you a lot: http://www.garagegames.com/community/forums/viewthread/45920
Edit: Had another link but realized it wasn't relevant.
I hope this helps, if I remember anything I'll let you know, good luck!
#4
The first thread is interesting though. I'll try fooling around with the export/importCachedFont functions and see how that comes out.
Thanks!
05/02/2012 (4:24 pm)
Yup, I saw the second link before. It's to enable bilinear filtering on text objects, which was added to the standard in 1.7.6.The first thread is interesting though. I'll try fooling around with the export/importCachedFont functions and see how that comes out.
Thanks!
#5
I did manage to finally get them to export by using this code:
(mostly used from the linked thread, with some minor editing). The path part was pretty ugly and took me a while to get it to work right. So, basically it looks like you can add padding on exportation, then you can just re-import it and hopefully the fonts will be fixed... see how that goes next!
05/02/2012 (6:21 pm)
Well, it looks like the fileName argument on importCachedFont and exportCachedFont are a little 'buggy'. They don't seem to use intelligent pathing like the rest of the engine, so you need to literally spell out the exact filepath in the argument.I did manage to finally get them to export by using this code:
function populateFonts()
{
%font = "Arial";
%sizes = "18 24 32 36";
// ---
for (%i = 0; %i < getWordCount(%sizes); %i++)
populateFontCacheRange(%font, getWord(%sizes, %i), 32, 126);
writeFontCache();
}
function fontbitmapIO(%import)
{
%font = "Arial";
%sizes = "18 24 32 36";
// ---
for (%i = 0; %i < getWordCount(%sizes); %i++)
{
%size = getWord(%sizes,%i);
%weight = 3;
// %weight = 0;
if (%import)
importCachedFont(%font, %size, ("C:/Users/Harry/AppData/Roaming/Independent/IAWDemo/game/"@ %font @" "@%size @ ".png"), %weight, 0);
else
exportCachedFont(%font, %size, ("C:/Users/Harry/AppData/Roaming/Independent/IAWDemo/game/"@ %font @" "@%size @ ".png"), %weight, 0);
}
writeFontCache();
}(mostly used from the linked thread, with some minor editing). The path part was pretty ugly and took me a while to get it to work right. So, basically it looks like you can add padding on exportation, then you can just re-import it and hopefully the fonts will be fixed... see how that goes next!
#6
05/02/2012 (6:51 pm)
Well, needed to keep the padding when importing it back in, but it does seem to have fixed the issue!
#7
05/02/2012 (8:29 pm)
Great to hear! I am thinking of going back to my project, and I'm glad I won't need to struggle with this again.
Torque Owner Justin Proffitt
Sorry you ran into this too, hope this helps! : /