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 - Voroz

Pages: 1 2 [3] 4 5 ... 9
31
SFML projects / Re: Let There Be Light 2
« on: October 11, 2015, 06:44:18 pm »
Why on earrh don't you limit the framerate to something sensible - like 60 or 75?
Why waste power rendering frames the users eyes cannot percieve?
I do limit the framerate to 60 fps, but it's good to unlimit it to check your performance and how much computing power certain things take. Someone with a worse computer might not even get 60 fps if you don't care about looking how fast your app actually can run and optimizing it. Also your fps might drop from 800 fps to a much lower fps briefly (stuttering), which is my problem.

32
SFML projects / Re: Let There Be Light 2
« on: October 11, 2015, 05:54:28 pm »
Btw, i notice the light system eats alot of fps. Does it take more fps than LTBL1 or is it around the same? And what are the advantages of LTBL2 compared to the first LTBL?

I'm using the first one in my game right now together with box2d, but i'm getting occasional stuttering which seems to be the cause of LTBL1.

It could also be from Box2d but i don't see any stuttering when i remove the light system, but that might be because i have 2000 fps instead of 800 fps when i remove LTBL1 so if the cause of stuttering is from box2d it might not show at that high fps.

33
SFML projects / Re: Let There Be Light 2
« on: October 11, 2015, 05:50:03 pm »
ah ok, i thought it was supposed to be a light like from a flashlight :)

34
SFML projects / Re: Let There Be Light 2
« on: October 11, 2015, 05:46:34 pm »
The sprite (the rectangle) should cover the screen. Try setting the dimensions to the screen size and positioning it so that it is centered on the screen.
okay, but it's still just a giant square covering the screen. I thought it was supposed to be a directional light?

35
SFML projects / Re: Let There Be Light 2
« on: October 11, 2015, 05:22:46 pm »
I seem to have trouble with the directional light. This code is following your example and i only get a rectangle:
#include <memory>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <ltbl/lighting/lightSystem.h>

using namespace std;

int main(){
sf::ContextSettings Settings;
Settings.depthBits         = 24; // Request a 24 bits depth buffer
Settings.stencilBits       = 8;  // Request a 8 bits stencil buffer
Settings.antialiasingLevel = 0;  // Request 2 levels of antialiasing
// Set Screen Size
sf::Vector2<double> screenSize;
screenSize.x = 1000;
screenSize.y = 800;

//Create the Window
sf::RenderWindow App(sf::VideoMode(screenSize.x, screenSize.y, 32), "Test LTBL2", sf::Style::Close, Settings);

//Frame Limit
App.setFramerateLimit(0);

//Vertical sync
App.setVerticalSyncEnabled(true);

// lights setup
sf::Texture directionLightTexture;

if (!directionLightTexture.loadFromFile("resources/directionLightTexture.png"));

directionLightTexture.setSmooth(true);

sf::Texture penumbraTexture;

if (!penumbraTexture.loadFromFile("resources/penumbraTexture.png"));

penumbraTexture.setSmooth(true);

ltbl::LightSystem ls;

sf::Shader unshadowShader;
sf::Shader lightOverShapeShader;

if (!unshadowShader.loadFromFile("resources/unshadowShader.vert", "resources/unshadowShader.frag"));
if (!lightOverShapeShader.loadFromFile("resources/lightOverShapeShader.vert", "resources/lightOverShapeShader.frag"));

ls.create(ltbl::rectFromBounds(sf::Vector2f(-1000.0f, -1000.0f), sf::Vector2f(1000.0f, 1000.0f)), App.getSize(), penumbraTexture, unshadowShader, lightOverShapeShader);

std::shared_ptr<ltbl::LightDirectionEmission> light = std::make_shared<ltbl::LightDirectionEmission>();

light->_emissionSprite.setOrigin(sf::Vector2f(directionLightTexture.getSize().x * 0.5f, directionLightTexture.getSize().y * 0.5f));
light->_emissionSprite.setTexture(directionLightTexture);
light->_emissionSprite.setScale(sf::Vector2f(1.0f, 1.0f));
light->_emissionSprite.setColor(sf::Color(255, 230, 200));
light->_emissionSprite.setPosition(sf::Vector2f(500, 400));
light->_castDirection = ltbl::vectorNormalize(sf::Vector2f(-0.1f, 0.6f));

ls.addLight(light);

while (App.isOpen()){
    sf::Event Event;
    while (App.pollEvent(Event)){
        // Window closed
        if (Event.type == sf::Event::Closed){
            App.close();
        }
        // Key Pressed
        if (Event.type == sf::Event::KeyPressed){
            //Quit
            if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)){
                App.close();
            }
        }
        if (Event.type == sf::Event::KeyReleased){
        }
    }



    App.clear(sf::Color(255,255,255));
    ls.render(App.getDefaultView(), unshadowShader, lightOverShapeShader);

    sf::Sprite sprite;
    sprite.setTexture(ls.getLightingTexture());

    sf::RenderStates lightRenderStates;
    lightRenderStates.blendMode = sf::BlendMultiply;

    App.draw(sprite, lightRenderStates);
    App.display();
}

return 0;
}

36
SFML projects / Re: Let There Be Light 2
« on: October 11, 2015, 05:15:30 pm »
In your example of using directional light i got the same result with the rectangle light btw. This is from your example:

        sf::Texture pointLightTexture;

        pointLightTexture.loadFromFile("resources/directionLightTexture.png");

        pointLightTexture.setSmooth(true);

        sf::Texture penumbraTexture;

        penumbraTexture.loadFromFile("resources/penumbraTexture.png");

        penumbraTexture.setSmooth(true);

        ltbl::LightSystem ls;

        sf::Shader unshadowShader;

        unshadowShader.loadFromFile("resources/unshadowShader.vert", "resources/unshadowShader.frag");

        ls.create(ltbl::rectFromBounds(sf::Vector2f(-1000.0f, -1000.0f), sf::Vector2f(1000.0f, 1000.0f)), window.getSize(), penumbraTexture, unshadowShader);

        std::shared_ptr<ltbl::LightDirectionEmission> light = std::make_shared<ltbl::LightDirectionEmission>();

        light->_emissionSprite.setOrigin(sf::Vector2f(pointLightTexture.getSize().x * 0.5f, pointLightTexture.getSize().y * 0.5f));
        light->_emissionSprite.setTexture(pointLightTexture);
        light->_emissionSprite.setScale(sf::Vector2f(6.0f, 6.0f));
        light->_emissionSprite.setColor(sf::Color(255, 230, 200));
        light->_emissionSprite.setPosition(sf::Vector2f(0.0f, 0.0f));
        light->_castDirection = ltbl::vectorNormalize(sf::Vector2f(-0.1f, 0.6f));
ls.addLight(light);

37
SFML projects / Re: Let There Be Light 2
« on: October 11, 2015, 05:11:03 pm »
Hello Voroz,

It seems like you are loading the directional light texture instead of the point light one  ;)
woah, that was a fast reply :). Yeah you're right, now it works :D.

38
SFML projects / Re: Let There Be Light 2
« on: October 11, 2015, 05:06:15 pm »
I'm trying to spawn a light for testing purposes, but i'm just seeing a hard rectangle shape instead of a smooth light. The rectangle is the same color as the light is supposed to be, but i only see the rectangle if i clear with white instead of standard black clear color.

This is the code i'm using:

#include <memory>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <ltbl/lighting/lightSystem.h>

using namespace std;

int main(){
sf::ContextSettings Settings;
Settings.depthBits         = 24; // Request a 24 bits depth buffer
Settings.stencilBits       = 8;  // Request a 8 bits stencil buffer
Settings.antialiasingLevel = 0;  // Request 2 levels of antialiasing
// Set Screen Size
sf::Vector2<double> screenSize;
screenSize.x = 1000;
screenSize.y = 800;

//Create the Window
sf::RenderWindow App(sf::VideoMode(screenSize.x, screenSize.y, 32), "Test LTBL2", sf::Style::Close, Settings);

//Frame Limit
App.setFramerateLimit(0);

//Vertical sync
App.setVerticalSyncEnabled(true);

// lights setup
sf::Texture pointLightTexture;

if (!pointLightTexture.loadFromFile("resources/directionLightTexture.png"));

pointLightTexture.setSmooth(true);

sf::Texture penumbraTexture;

if (!penumbraTexture.loadFromFile("resources/penumbraTexture.png"));

penumbraTexture.setSmooth(true);

ltbl::LightSystem ls;

sf::Shader unshadowShader;
sf::Shader lightOverShapeShader;

if (!unshadowShader.loadFromFile("resources/unshadowShader.vert", "resources/unshadowShader.frag"));
if (!lightOverShapeShader.loadFromFile("resources/lightOverShapeShader.vert", "resources/lightOverShapeShader.frag"));

ls.create(ltbl::rectFromBounds(sf::Vector2f(-1000.0f, -1000.0f), sf::Vector2f(1000.0f, 1000.0f)), App.getSize(), penumbraTexture, unshadowShader, lightOverShapeShader);

std::shared_ptr<ltbl::LightPointEmission> light = std::make_shared<ltbl::LightPointEmission>();

light->_emissionSprite.setOrigin(sf::Vector2f(pointLightTexture.getSize().x * 0.5f, pointLightTexture.getSize().y * 0.5f));
light->_emissionSprite.setTexture(pointLightTexture);
light->_emissionSprite.setScale(sf::Vector2f(1.0f, 1.0f));
light->_emissionSprite.setColor(sf::Color(255, 230, 200));
light->_emissionSprite.setPosition(sf::Vector2f(500, 400));

ls.addLight(light);

while (App.isOpen()){
    sf::Event Event;
    while (App.pollEvent(Event)){
        // Window closed
        if (Event.type == sf::Event::Closed){
            App.close();
        }
        // Key Pressed
        if (Event.type == sf::Event::KeyPressed){
            //Quit
            if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)){
                App.close();
            }
        }
        if (Event.type == sf::Event::KeyReleased){
        }
    }



    App.clear(sf::Color(255,255,255));
    ls.render(App.getDefaultView(), unshadowShader, lightOverShapeShader);

    sf::Sprite sprite;
    sprite.setTexture(ls.getLightingTexture());

    sf::RenderStates lightRenderStates;
    lightRenderStates.blendMode = sf::BlendMultiply;

    App.draw(sprite, lightRenderStates);
    App.display();
}

return 0;
}

39
General / Re: problems with c++14
« on: October 11, 2015, 01:38:40 pm »
I thought it was a member of stdlib. Although it's not my code, it's LTBL2 so everything necessary is supposed to be included already.

40
General / Re: problems with c++14
« on: October 11, 2015, 01:33:52 pm »
no, what's that supposed to do? Anyway i don't know why but when i checked the flag it was set to c++11 again, and then i changed it and now it works. I did set it to c++14 and rebuilt it and restarted it and it was set to c++14 multiple times when i tried running it, and i recreated the flag etc and it never worked. Suddenly now it works.. weird.

41
General / Re: problems with c++14
« on: October 11, 2015, 01:29:26 pm »
By complain i mean that it actually told me that it doesn't recognize the command for -std=c++16. It doesn't say anything like that about -std=c++14, but it tells me that make_unique is not a member of std.

42
General / Re: problems with c++14
« on: October 11, 2015, 01:25:15 pm »
So if you use -std=c++14 it worked? Then why do you try to use -std=c++16 which is no C++ standard?
No i mean that it doesn't work with -std=c++14. I just tried -std=c++16 to see if the compiler complained about that one, so i knew it actually recognized the -std=c++14 command.

43
General / problems with c++14
« on: October 11, 2015, 12:55:06 pm »
Hi!
I just upgraded to mingw 5.2 and trying to use LTBL2 which is using c++14 features, but when i try to compile i get "'make_unique' is not a member of 'std'"

I created a flag -std=c++14 in project build options -> compiler flags, and it doesn't complain about it. I tried changing to -std=c++16, and then it wouldn't run, so it does recognize the command.
So why do i still get this error?

Thanks.

44
General / Re: Too much screen tearing
« on: August 06, 2015, 01:50:04 am »
Is it possible that you're not calling clear() and display() every frame and only once?
no i'm doing that, and only once. Have you tried without vsync? To see if you experience alot of tearing aswell.

45
General / Re: Too much screen tearing
« on: August 05, 2015, 05:13:33 am »
I guess what i need to bypass the vsync problem is a hardware cursor then. I don't think i have any more delay in mouse movement than anyone else, but i might be more bothered by it :).
I still don't get why i get constant tearing instead of the occasional tearing that i might see in another game, and i'm pretty sure i'm not doing anything weird in my code like you say, atleast not anything that would cause extra tearing, but i guess i'll just wait for hardware cursor support and enable vsync.

Thanks for your help.

Pages: 1 2 [3] 4 5 ... 9
anything