(C++ and SFML noob)
Been looking at this for 4 hours now. Got me beat. I can't load a shader from a file. I am running VS Express 2012, SFML 2.1, Windows 8.
My code:
sf::Shader shader;
shader.loadFromFile("C:\\Users\\Stewart\\Documents\\Visual Studio 2012\\Projects\\Stewmines\\bloom", sf::Shader::Fragment);
The shader. (Downloaded and pasted). I just wanted to get something working before I started hacking away.
uniform sampler2D bgl_RenderedTexture;
void main()
{
vec4 sum = vec4(0);
vec2 texcoord = vec2(gl_TexCoord[0]);
int j;
int i;
for( i= -4 ;i < 4; i++)
{
for (j = -3; j < 3; j++)
{
sum += texture2D(bgl_RenderedTexture, texcoord + vec2(j, i)*0.004) * 0.25;
}
}
if (texture2D(bgl_Rend eredTexture, texcoord).r < 0.3)
{
gl_FragColor = sum*sum*0.012 + texture2D(bgl_RenderedTexture, texcoord);
}
else
{
if (texture2D(bgl_RenderedTexture, texcoord).r < 0.5)
{
gl_FragColor = sum*sum*0.009 + texture2D(bgl_RenderedTexture, texcoord);
}
else
{
gl_FragColor = sum*sum*0.0075 + texture2D(bgl_RenderedTexture, texcoord);
}
}
}
When my program executes the loadFromFile member function I get the following error
Unhandled exception at 0x6E31DD22 (msvcr110.dll) in Stewmines.exe: 0xC0000005: Access violation reading location 0x00995000.
The output window gives me the following garble. Note the total output is about 100 - 200 lines however I have included only the last two as each line is the same as the first.
■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯
■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■¯■^↨ÏP☻´ ♥î û î û 8 û 8
û PÖ
The output that VS gives me. Again I have only added the last few lines to keep this post sane
.
First-chance exception at 0x6E31DD22 (msvcr110.dll) in Stewmines.exe: 0xC0000005: Access violation reading location 0x00995000.
Unhandled exception at 0x6E31DD22 (msvcr110.dll) in Stewmines.exe: 0xC0000005: Access violation reading location 0x00995000.
The thread 0x9f4 has exited with code 0 (0x0).
The thread 0x1524 has exited with code 0 (0x0).
The program '[8024] Stewmines.exe' has exited with code 0 (0x0).