【发布时间】:2016-08-28 15:45:02
【问题描述】:
使用 SFML 2.4,我想在屏幕上绘制文本并使用片段着色器对其应用效果。但是当我尝试时,文本是用正方形而不是字符绘制的
片段着色器:
void main() { gl_FragColor= vec4(1,0,0,1); }
SFML 文本代码:
sf::Text t;
t.setFont(myFont);
t.setCharacterSize(10);
t.setColor(sf::Color::White);
t.setString("this is a test");
//myWindow.draw(t); // This displays a white "this is a test"
//myWindow.draw(t, myShader); // This displays red squares instead of characters
我希望我的着色器以红色显示该文本。但相反,我得到了红色方块。每个方块都是应该存在的角色边界框的大小。 我在这里遗漏了一些明显的东西吗?还是 sf::Text 不打算这样使用?
【问题讨论】: