Hi I built sfml 2.5.1 on my system with g++ 5.4.0 (defaulted on my system) and I'm trying out the LTBL2 library.
It tries to create a RenderTexture but is segfaulting when it gets initialised.
Heres a backtrace:
#0 0x00007ffff7b94ed4 in sf::RenderTarget::initialize (this=0x7fffffffd670) at SFML/Graphics/RenderTarget.cpp:545
#1 0x00007ffff7b933d4 in sf::RenderTexture::create (this=0x7fffffffd670, width=800, height=600, settings=...) at SFML/Graphics/RenderTexture.cpp:92
#2 0x00007ffff7b93264 in sf::RenderTexture::create (this=0x7fffffffd670, width=800, height=600, depthBuffer=false) at SFML/Graphics/RenderTexture.cpp:54
#3 0x00007ffff748cfbe in ltbl::LightSystem::create (this=0x7fffffffd460, rootRegion=..., imageSize=..., penumbraTexture=..., unshadowShader=..., lightOverShapeShader=...) at /ltbl/lighting/LightSystem.cpp:603
#4 0x000000000040898d in main () at main.cpp:18
And project files:
main.cpp
#include <SFML/Graphics.hpp>
#include "ltbl/lighting/LightSystem.h"
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "Test");
sf::Shader unshadowShader;
sf::Shader lightOverShapeShader;
sf::Texture penumbraTexture;
//I omitted the loading
ltbl::LightSystem ls;
ls.create(sf::FloatRect(-1000.0f, -1000.0f, 1000.0f, 1000.0f), window.getSize(), penumbraTexture, unshadowShader, lightOverShapeShader);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.display();
}
return 0;
}
LightSystem.cpp
void LightSystem::create(const sf::FloatRect &rootRegion, const sf::Vector2u &imageSize, const sf::Texture &penumbraTexture, sf::Shader &unshadowShader, sf::Shader &lightOverShapeShader) {
_shapeQuadtree.create(rootRegion);
_lightPointEmissionQuadtree.create(rootRegion);
_lightTempTexture.create(imageSize.x, imageSize.y); // <- this works fine apparently
_emissionTempTexture.create(imageSize.x, imageSize.y); // <- what is getting called
_antumbraTempTexture.create(imageSize.x, imageSize.y);
_compositionTexture.create(imageSize.x, imageSize.y);
sf::Vector2f targetSizeInv = sf::Vector2f(1.0f / imageSize.x, 1.0f / imageSize.y);
unshadowShader.setParameter("penumbraTexture", penumbraTexture);
lightOverShapeShader.setParameter("emissionTexture", _emissionTempTexture.getTexture());
lightOverShapeShader.setParameter("targetSizeInv", targetSizeInv);
}
I'm not sure what I'm doing exactly wrong if anyone could guide me it would be very appreciated, thank you!