Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Alias

Pages: [1]
1
Graphics / RenderTarget::initialize Segfault
« on: November 09, 2018, 09:10:08 pm »
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!

2
SFML projects / Re: Let There Be Light 2
« on: November 05, 2018, 02:11:57 am »
Hey while using Cmdu76's version of the library I am getting a segfault in the LightSystem::Update(sf::Vector2u const& size) function at mEmissionTempTexture.create(size.x, size.y); while running the example project (https://github.com/Cmdu76/LTBL2/blob/master/examples/main.cpp).

Here is the backtrace:

#0  0x00007ffff7b94ed4 in sf::RenderTarget::initialize (this=0x7fffffffd628) at /SFML/Graphics/RenderTarget.cpp:545
#1  0x00007ffff7b933d4 in sf::RenderTexture::create (this=0x7fffffffd628, width=800, height=600, settings=...) at SFML/Graphics/RenderTexture.cpp:92
#2  0x00007ffff7b93264 in sf::RenderTexture::create (this=0x7fffffffd628, width=800, height=600, depthBuffer=false) at SFML/Graphics/RenderTexture.cpp:54
#3  0x000000000041ac01 in ltbl::LightSystem::update (this=0x7fffffffd070, size=...) at LTBL/LightSystem.cpp:330
#4  0x0000000000418ff3 in ltbl::LightSystem::create (this=0x7fffffffd070, rootRegion=..., imageSize=...) at LTBL/LightSystem.cpp:44
#5  0x0000000000406e87 in main () at main.cpp:43

And here's some screenshots of the output:



Anybody see what I'm doing wrong?

Pages: [1]
anything