I tried to load the shader using the loadFromMemory function, but the console produces a strange error. Here is my code:
#include <string>
#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
RenderWindow window(VideoMode(800, 600), "SFML", Style::Close);
const std::string shade = "void main(){}";
Shader shader;
if (!shader.loadFromMemory(shade, Shader::Fragment)) {
exit(-1);
}
return 0;
}
Here is console output:
Failed to compile fragment shader:
0(1) : error C0000: syntax error, unexpected $undefined at token "<undefined>"
How can I fix this?