Hello, everybody.
I'm trying to compile this code found
HERE, but I can't seem to get it right.
#include <SFML/Graphics.hpp>
uniform sampler2D texture;
uniform vec4 colorkey;
void main()
{
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
if (pixel == colorkey)
pixel.a = 0;
gl_FragColor = pixel;
}
But the compiler cannot seem to be able to find anything about shaders, giving me these errors:
error: 'uniform' does not name a type
error: 'uniform' does not name a type
error: '::main' must return 'int'
error: 'vec4' was not declared in this scope
error: expected ';' before 'pixel'
error: 'pixel' was not declared in this scope
error: 'colorkey' was not declared in this scope
error: 'gl_FragColor' was not declared in this scope
error: 'pixel' was not declared in this scope
I have checked, though, and "Shaders.hpp" is in the "Graphics" folder, so I don't know why it can't read it.
I don't really know what I'm doing here, since the Tutorials only cover how to read a .frag file and not how to create one, so I just assumed that if I compile this code it will create a .frag file. This is the very first time I'm trying to utilize shaders, so I might be doing a lot of things wrong.
Everything that does not include shaders works great so far, so I don't really know where the problem actually is.
Any help would be appreciated.
Thank you in advance.