我想平滑点并使其变大。我尝试过以下方法:
#include <SFML/Graphics.hpp>
#define WIDTH 100
int main() {
sf::RenderWindow window(sf::VideoMode(WIDTH, WIDTH), "Test");
sf::Shader shader;
shader.loadFromMemory(
"#version 140\n"
"void main() {\n"
"gl_PointSize = 10; // Not working\n"
"gl_Position = gl_Vertex;\n"
"}\n",
"#version 140\n"
"out vec4 out_Colour;\n"
"void main(void) {\n"
"out_Colour = vec4(vec3(1.0), 1.0);\n"
"}\n"
);
sf::VertexArray points(sf::Points, 3);
points[0].position = sf::Vector2f(0, 0);
points[1].position = sf::Vector2f(-.1, -.1);
points[2].position = sf::Vector2f(.1, .1);
while(window.isOpen()) {
sf::Event currEvent;
while(window.pollEvent(currEvent)) {
switch(currEvent.type) {
case(sf::Event::Closed): window.close(); break;
}
}
window.clear();
window.draw(points, &shader);
window.display();
}
}
不幸的是,gl_PointSize
似乎不起作用:
有什么问题吗?
1条答案
按热度按时间0g0grzrc1#
不幸的是,对于GLSL,GL没有 Package 器来启用这种模式。
您可以添加以下内容:
然后您会得到以下输出:
不要忘记链接库: