I'm using a Radion HD 5750 (and version 12.10 of the drivers,) and I experience the same problem using the latest source. Well, not quite the latest -- I haven't updated for the static library fix. While playing around with the code Kylotan provided to show the issue, I found that changing either of the background or outline alpha settings to 0 (or setting the outline thickness to 0) caused the text to display properly. I also noticed that drawing the rectangle elsewhere on the screen still seems to screw up the display of the text.
When I put together some code to test multiple scenarios in one run, that behavior disappeared, so I suspect it had something do with the initial state of the graphics subsystem.
This was the code for reference:
#include <SFML/Graphics.hpp>
struct Scenario {
sf::Color background ;
sf::Color box_fill ;
sf::Color box_outline ;
sf::Vector2f box_position ;
sf::Vector2f box_size ;
float box_outline_thickness ;
sf::Text text ;
};
void doScenario(sf::RenderWindow& window, const Scenario& s) ;
int main()
{
sf::RenderWindow window(sf::VideoMode(150, 150), "Test");
sf::Font font ;
font.loadFromFile("sketchflow.ttf") ;
sf::Text text("abcdefgh", font) ;
text.setPosition(sf::Vector2f(10.0f,10.0f)) ;
text.setCharacterSize(20) ;
const sf::Color bg(10, 30, 10) ;
const sf::Vector2f offTextPos(10.0f, 100.0f) ;
const sf::Vector2f throughTextPos(10.0f, 25.0f) ;
const sf::Vector2f onTextPos ( 10.0f, 10.0f ) ;
const sf::Color fill_alphaOff(128, 128, 128, 0) ;
const sf::Color fill_alphaOn(128, 128, 128, 255) ;
const sf::Color fill_alphaMid(128, 128, 128, 128) ;
const sf::Color outline_alphaOff(255, 255, 255, 0 ) ;
const sf::Color outline_alphaOn(255, 255, 255, 255) ;
const sf::Color outline_alphaMid(255, 255, 255, 128) ;
const float thicknessOn = 2.0f ;
const float thicknessOff = 0.0f ;
const sf::Vector2f rectSize(100, 30) ;
Scenario scenarios[] =
{
// bg color, box_fill, box_outline, box_position, box_size, box_outline_thickness
{ bg, fill_alphaOn, outline_alphaOn, onTextPos, rectSize, thicknessOn, text },
{ bg, fill_alphaOn, outline_alphaOn, throughTextPos, rectSize, thicknessOn, text },
{ bg, fill_alphaOn, outline_alphaOn, offTextPos, rectSize, thicknessOn, text },
{ bg, fill_alphaOn, outline_alphaOn, offTextPos, rectSize, thicknessOff, text },
{ bg, fill_alphaOff, outline_alphaOn, offTextPos, rectSize, thicknessOn, text },
{ bg, fill_alphaOn, outline_alphaOff, offTextPos, rectSize, thicknessOn, text },
// text shows correctly only for these two cases:
{ bg, fill_alphaOff, outline_alphaOn, offTextPos, rectSize, thicknessOff, text },
{ bg, fill_alphaOff, outline_alphaOff, offTextPos, rectSize, thicknessOn, text }
};
for ( unsigned i=0 ; i<sizeof(scenarios)/sizeof(scenarios[0]); ++i )
doScenario(window, scenarios[i]) ;
}
bool processEvents( sf::RenderWindow & window )
{
bool continueProcessing = true ;
sf::Event event ;
while ( window.pollEvent(event) )
{
switch (event.type)
{
case sf::Event::Closed:
continueProcessing = false ;
window.close() ;
break ;
case sf::Event::KeyReleased:
continueProcessing = false ;
break ;
}
}
return continueProcessing ;
}
void doScenario( sf::RenderWindow& window, const Scenario& s )
{
sf::RectangleShape rect ;
rect.setPosition(s.box_position) ;
rect.setSize(s.box_size) ;
rect.setFillColor(s.box_fill) ;
rect.setOutlineColor(s.box_outline) ;
rect.setOutlineThickness(s.box_outline_thickness) ;
const sf::Text & t = s.text ;
while ( window.isOpen() && processEvents(window) )
{
window.clear(s.background);
window.draw(rect) ;
window.draw(t) ;
window.display() ;
}
}
Result: