I don't know if this is what you're going for, but...
#include <SFML\Graphics.hpp>
#include <SFML\System.hpp>
#include <SFML\Window.hpp>
#include <iostream>
void main()
{
sf::RenderWindow _window(sf::VideoMode(800, 480, 32), "Lighting Test");
_window.setFramerateLimit(60) ;
sf::RenderTexture plainScene ;
plainScene.create(_window.getSize().x, _window.getSize().y);
sf::RenderTexture shadedScene;
shadedScene.create(_window.getSize().x, _window.getSize().y) ;
sf::Texture texture;
texture.loadFromFile("image.png");
sf::Sprite sprite = sf::Sprite(texture);
sf::Sprite sprite2 = sf::Sprite(texture);
//sprite.setTexture(texture);
sf::Texture backgroundTexture;
backgroundTexture.loadFromFile("light2.png");
sf::Sprite background = sf::Sprite(backgroundTexture);
//background.setTexture(backgroundTexture);
sf::Shader lightingShader ;
lightingShader.loadFromFile("lightingShader.frag", sf::Shader::Type::Fragment);
lightingShader.setParameter("exposure", 0.008f);
lightingShader.setParameter("decay", 0.97f);
lightingShader.setParameter("density", 0.97f);
lightingShader.setParameter("weight", 5.5f);
lightingShader.setParameter("lightPositionOnScreen", sf::Vector2f(0.5f, 0.5f));
sf::RenderStates renderState(&lightingShader) ;
while (_window.isOpen())
{
int x = sf::Mouse::getPosition(_window).x;
int y = sf::Mouse::getPosition(_window).y;
sf::Event sfEvent;
while(_window.pollEvent(sfEvent))
{
switch(sfEvent.type)
{
case sf::Event::Closed: _window.close();
break;
case sf::Event::KeyPressed:
if(sfEvent.key.code==sf::Keyboard::Q) _window.close();
break;
default: break;
}
}
sf::RenderStates blendState(sf::BlendAlpha) ;
sprite.setPosition(x - 504, y - 360);
plainScene.clear() ;
shadedScene.clear() ;
_window.clear() ;
plainScene.draw(background) ;
plainScene.draw(sprite) ;
plainScene.display() ;
shadedScene.draw(sf::Sprite(plainScene.getTexture()), renderState) ;
shadedScene.display();
_window.draw(sf::Sprite(plainScene.getTexture())) ;
_window.draw(sf::Sprite(shadedScene.getTexture()), sf::RenderStates(sf::BlendAdd));
_window.display();
}
}