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

Author Topic: SFML Light System - Let There Be Light  (Read 258793 times)

0 Members and 3 Guests are viewing this topic.

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #195 on: February 05, 2013, 11:03:03 pm »
Are there any plans about implementing a lighting system into sfml? And why 'no'?
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: SFML Light System - Let There Be Light
« Reply #196 on: February 06, 2013, 01:49:19 am »
Are there any plans about implementing a lighting system into sfml? And why 'no'?
No, because SFML is a low level library (not a framework nor engine), that provides a nice API for accessing multimedia related things. With such an API you get the chance to implement a lighting system on your own on top of it, like 'Let There Be Light' proves to work. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #197 on: February 07, 2013, 03:02:18 pm »
After downloading latest snapshot, sf::Shader::bind(); is working. Had to rewrite some texturebindings to sf::Texture::bind(&sf::Texture); is it right, that there is no call for sf::Texture::bind(NULL); ? and when compiling, my IDE (MSVC) throws error, that he can't find the sf::Shader::bind() in the DLLs or sth.

Here the errorcode (german):

1>LightSystem.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: static void __cdecl sf::Shader::bind(class sf::Shader const *)" (__imp_?bind@Shader@sf@@SAXPBV12@@Z)".
1>LightSystem.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: static void __cdecl sf::Texture::bind(class sf::Texture const *,enum sf::Texture::CoordinateType)" (__imp_?bind@Texture@sf@@SAXPBV12@W4CoordinateType@12@@Z)".


Help me please :)
PS: There aren't any sfml-*.lib files in the snapshot... (so I didn't replace the old ones)
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: SFML Light System - Let There Be Light
« Reply #198 on: February 07, 2013, 03:13:53 pm »
After downloading latest snapshot, sf::Shader::bind(); is working.
PS: There aren't any sfml-*.lib files in the snapshot... (so I didn't replace the old ones)
You obviously have to also build SFML... ::)
There aren't any official binaries other than the SFML 2 RC ones.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #199 on: February 07, 2013, 03:21:31 pm »
You can't just use the old .lib files. If you use the new source you either have to recompile it yourself or use the precompiled unofficial nightly builds.

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #200 on: February 07, 2013, 03:22:26 pm »
After downloading latest snapshot, sf::Shader::bind(); is working.
PS: There aren't any sfml-*.lib files in the snapshot... (so I didn't replace the old ones)
You obviously have to also build SFML... ::)
There aren't any official binaries other than the SFML 2 RC ones.

Ah, yes ofcourse... :)
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #201 on: February 07, 2013, 09:14:54 pm »
So, that is what I did:
-CMaked the latest snapshot and built in msvc as release (game also running release mode)
-Changed some calls to sf::Shader::bind() and sf::Texture::bind()
=> Building now properly, but the game still crashes. I can't call ls->RemoveLight(pLight) without crash, either.

What to do? Maybe some Heap Errors?


EDIT: Finally solved my problem. Turned out, that there were some mistakes managing the pointers and their assigned memory, because std::vector seems to construct its objects again after erasing single elements. I had a std::vector<Ammo> where Ammo has its own light. When erasing an Ammo they kinda get reconstructed for sorting the vector's list (closing gaps). Now i used a vector of pointers: std::vector<Ammo*> addind new Ammo with *.push_back(new Ammo()). So the vector is recreating the pointers, not my objects. (Of course I configured the destructors for deleting the objects properly).

Dat Heap :)
Thank you for the help anyway :)
« Last Edit: February 10, 2013, 01:18:59 pm by kralo9 »
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

Deftwun

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #202 on: May 01, 2013, 02:39:33 pm »
Has anyone out there ever managed to get LTBL to work without convex hulls and instead with line segments? I'm just curious if this is possible as I use box2d with Chain shapes as my level terrain collision.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #203 on: May 01, 2013, 09:50:34 pm »
If you make a convex hull with only 2 points (a line segment), it should still work.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

dragondgold

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #204 on: May 14, 2013, 04:48:40 pm »
Hello! I am trying to get started with this. I downloaded the latest release from http://sourceforge.net/projects/letthebelight/files/ and added the source folder to my include path. But when I try to write a simple code to test:

#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <LTBL/Light/LightSystem.h>
#include <LTBL/Light/Light.h>
#include <LTBL/Constructs/AABB.h>
#include <iostream>
#include <assert.h>

using namespace std;

int main() {

        sf::VideoMode vidMode;
        vidMode.width = 800;
        vidMode.height = 600;
        vidMode.bitsPerPixel = 32;
        assert(vidMode.isValid());

        sf::RenderWindow mWindow(vidMode, "Prueba Light");

        // Light System
        ltbl::LightSystem ls(AABB(Vec2f(0.0f, 0.0f),
                Vec2f(static_cast<float>(vidMode.width), static_cast<float>(vidMode.height))), &mWindow,
                "lightFin.png", "lightAttenuationShader.frag");


        // Create a light
        ltbl::Light_Point* testLight = new ltbl::Light_Point();
        testLight->m_center = Vec2f(200.0f, 200.0f);
        testLight->m_radius = 500.0f;
        testLight->m_size = 30.0f;
        testLight->m_spreadAngle = 2.0f * static_cast<float>(3.14159265);
        testLight->m_softSpreadAngle = 0.0f;
        testLight->CalculateAABB();
        lightSystem.AddLight(testLight);


        while(mWindow.isOpen()){
                sf::Event mEvent;
                while (mWindow.pollEvent(mEvent)){
                        if (mEvent.type == sf::Event::Closed ||
                                ((mEvent.type == sf::Event::KeyPressed) && (mEvent.key.code == sf::Keyboard::Escape))){
                                mWindow.close();
                        }
                }
                mWindow.clear();
                mWindow.display();
        }

        return 0;
}

In the line:

ltbl::Light* testLight = new ltbl::Light();

I get the error:
The type 'ltbl::Light' must implement the inherited pure virtual method 'ltbl::Light::RenderLightSolidPortion'


I don't know if I have to compile it and add libraries like in SFML I haven't found anything, so I tried building with cmake with this git repository: https://github.com/hovatterz/light
I am on Ubuntu 12.04 so installed boost with:

sudo apt-get install libboost-all-dev

Then cmake . and then when I do make i get an error, here is what I get in the console:

andres@Andres-NT:~/Dropbox/Development/light$ cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.53.0
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
Found SFML: /usr/local/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/andres/Dropbox/Development/light
andres@Andres-NT:~/Dropbox/Development/light$ make
Scanning dependencies of target ltbl
[  9%] Building CXX object CMakeFiles/ltbl.dir/src/Constructs.o
[ 18%] Building CXX object CMakeFiles/ltbl.dir/src/ConvexHull.o
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14,
                 from /home/andres/Dropbox/Development/light/include/LTBL/ConvexHull.h:6,
                 from /home/andres/Dropbox/Development/light/src/ConvexHull.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeOccupant.h:39:17: warning: class ‘qdt::AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/ConvexHull.h:6,
                 from /home/andres/Dropbox/Development/light/src/ConvexHull.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:55:16: warning: class ‘qdt::QuadTreeNode’ is implicitly friends with itself [enabled by default]
[ 27%] Building CXX object CMakeFiles/ltbl.dir/src/Light.o
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light.h:6,
                 from /home/andres/Dropbox/Development/light/src/Light.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeOccupant.h:39:17: warning: class ‘qdt::AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light.h:6,
                 from /home/andres/Dropbox/Development/light/src/Light.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:55:16: warning: class ‘qdt::QuadTreeNode’ is implicitly friends with itself [enabled by default]
[ 36%] Building CXX object CMakeFiles/ltbl.dir/src/LightSystem.o
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light.h:6,
                 from /home/andres/Dropbox/Development/light/include/LTBL/LightSystem.h:4,
                 from /home/andres/Dropbox/Development/light/src/LightSystem.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeOccupant.h:39:17: warning: class ‘qdt::AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light.h:6,
                 from /home/andres/Dropbox/Development/light/include/LTBL/LightSystem.h:4,
                 from /home/andres/Dropbox/Development/light/src/LightSystem.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:55:16: warning: class ‘qdt::QuadTreeNode’ is implicitly friends with itself [enabled by default]
[ 45%] Building CXX object CMakeFiles/ltbl.dir/src/Light_Beam.o
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light.h:6,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light_Beam.h:4,
                 from /home/andres/Dropbox/Development/light/src/Light_Beam.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeOccupant.h:39:17: warning: class ‘qdt::AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light.h:6,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light_Beam.h:4,
                 from /home/andres/Dropbox/Development/light/src/Light_Beam.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:55:16: warning: class ‘qdt::QuadTreeNode’ is implicitly friends with itself [enabled by default]
[ 54%] Building CXX object CMakeFiles/ltbl.dir/src/QuadTree.o
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14,
                 from /home/andres/Dropbox/Development/light/src/QuadTree.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeOccupant.h:39:17: warning: class ‘qdt::AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14:0,
                 from /home/andres/Dropbox/Development/light/src/QuadTree.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:55:16: warning: class ‘qdt::QuadTreeNode’ is implicitly friends with itself [enabled by default]
[ 63%] Building CXX object CMakeFiles/ltbl.dir/src/QuadTreeNode.o
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/light/src/QuadTreeNode.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeOccupant.h:39:17: warning: class ‘qdt::AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/light/src/QuadTreeNode.cpp:1:0:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:55:16: warning: class ‘qdt::QuadTreeNode’ is implicitly friends with itself [enabled by default]
[ 72%] Building CXX object CMakeFiles/ltbl.dir/src/QuadTreeOccupant.o
In file included from /home/andres/Dropbox/Development/light/src/QuadTreeOccupant.cpp:1:0:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeOccupant.h:39:17: warning: class ‘qdt::AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/light/src/QuadTreeOccupant.cpp:3:0:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:55:16: warning: class ‘qdt::QuadTreeNode’ is implicitly friends with itself [enabled by default]
[ 81%] Building CXX object CMakeFiles/ltbl.dir/src/SFML_OpenGL.o
[ 90%] Building CXX object CMakeFiles/ltbl.dir/src/ShadowFin.o
Linking CXX shared library lib/libltbl.so
[ 90%] Built target ltbl
[100%] Building CXX object bin/CMakeFiles/sample.dir/main.o
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light.h:6,
                 from /home/andres/Dropbox/Development/light/include/LTBL/LightSystem.h:4,
                 from /home/andres/Dropbox/Development/light/sample/main.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeOccupant.h:39:17: warning: class ‘qdt::AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/light/include/LTBL/QuadTree.h:14:0,
                 from /home/andres/Dropbox/Development/light/include/LTBL/Light.h:6,
                 from /home/andres/Dropbox/Development/light/include/LTBL/LightSystem.h:4,
                 from /home/andres/Dropbox/Development/light/sample/main.cpp:1:
/home/andres/Dropbox/Development/light/include/LTBL/QuadTreeNode.h:55:16: warning: class ‘qdt::QuadTreeNode’ is implicitly friends with itself [enabled by default]
/home/andres/Dropbox/Development/light/sample/main.cpp: In function ‘int main(int, char**)’:
/home/andres/Dropbox/Development/light/sample/main.cpp:144:51: error: ‘snprintf’ was not declared in this scope
make[2]: *** [bin/CMakeFiles/sample.dir/main.o] Error 1
make[1]: *** [bin/CMakeFiles/sample.dir/all] Error 2
make: *** [all] Error 2
 

Hope you can help me  :)

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #205 on: May 15, 2013, 02:43:01 am »
ltbl::Light* testLight = new ltbl::Light();

As far as I can tell, this isn't in the code sample you posted. ltbl::Light is a base class only, and cannot be instantiated by itself. Use ltbl::Light_Point to create a point light.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

dragondgold

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #206 on: May 15, 2013, 03:31:21 am »
ltbl::Light* testLight = new ltbl::Light();

As far as I can tell, this isn't in the code sample you posted. ltbl::Light is a base class only, and cannot be instantiated by itself. Use ltbl::Light_Point to create a point light.

Sorry, yeah, I am getting this error using Light() as the PDF in v1.5.1 says. I changed it to use Light_Point and after adding some includes and deleting -std=c++0x flag from my compiler some errors have dissapeared but I still get this errors:

make all
Building file: ../src/PruebaLightSFML.cpp
Invoking: GCC C++ Compiler
g++ -I/home/andres/Dropbox/Development/SFML-2.0/include -I/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/PruebaLightSFML.d" -MT"src/PruebaLightSFML.d" -o "src/PruebaLightSFML.o" "../src/PruebaLightSFML.cpp"
In file included from /usr/include/c++/4.6/unordered_set:35:0,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:9,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTree.h:4,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/StaticQuadTree.h:4,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Light/LightSystem.h:30,
                 from ../src/PruebaLightSFML.cpp:7:
/usr/include/c++/4.6/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
In file included from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTree.h:4,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/StaticQuadTree.h:4,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Light/LightSystem.h:30,
                 from ../src/PruebaLightSFML.cpp:7:
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Constructs/AABB.h:54:15: warning: class ‘AABB’ is implicitly friends with itself [enabled by default]
In file included from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTree.h:4:0,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/StaticQuadTree.h:4,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Light/LightSystem.h:30,
                 from ../src/PruebaLightSFML.cpp:7:
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:21:39: warning: ‘>>’ operator will be treated as two right angle brackets in C++0x [-Wc++0x-compat]
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:21:39: note: suggest parentheses around ‘>>’ expression
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:21:43: error: ‘m_children’ was not declared in this scope
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:21:43: error: ‘*’ cannot appear in a constant-expression
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:21:39: error: ‘>>’ should be ‘> >’ within a nested template argument list
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:24:3: error: ‘unordered_set’ in namespace ‘std’ does not name a type
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:41:26: error: ‘std::unordered_set’ has not been declared
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:41:39: error: expected ‘,’ or ‘...’ before ‘<’ token
In file included from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/StaticQuadTree.h:4:0,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Light/LightSystem.h:30,
                 from ../src/PruebaLightSFML.cpp:7:
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTree.h:16:3: error: ‘unordered_set’ in namespace ‘std’ does not name a type
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTree.h:18:3: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
In file included from ../src/PruebaLightSFML.cpp:7:0:
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Light/LightSystem.h:47:3: error: ‘unordered_set’ in namespace ‘std’ does not name a type
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Light/LightSystem.h:49:3: error: ‘unordered_set’ in namespace ‘std’ does not name a type
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Light/LightSystem.h:51:3: error: ‘unordered_set’ in namespace ‘std’ does not name a type
make: *** [src/PruebaLightSFML.o] Error 1

And this is my code:

#include <iostream>
#include <cmath>
#include <assert.h>
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <LTBL/Light/LightSystem.h>

using namespace std;
using namespace ltbl;

int main() {

        sf::VideoMode vidMode;
        vidMode.width = 800;
        vidMode.height = 600;
        vidMode.bitsPerPixel = 32;
        assert(vidMode.isValid());

        sf::RenderWindow mWindow(vidMode, "Prueba Light");

        // Light System
        LightSystem ls(AABB(Vec2f(0.0f, 0.0f),
                Vec2f(static_cast<float>(vidMode.width), static_cast<float>(vidMode.height))), &mWindow,
                "lightFin.png", "lightAttenuationShader.frag");


        // Create a light
        Light_Point* testLight = new Light_Point();
        testLight->m_center = Vec2f(200.0f, 200.0f);
        testLight->m_radius = 500.0f;
        testLight->m_size = 30.0f;
        testLight->m_spreadAngle = 2.0f * static_cast<float>(M_PI);
        testLight->m_softSpreadAngle = 0.0f;
        testLight->CalculateAABB();
        ls.AddLight(testLight);

        while(mWindow.isOpen()){
                sf::Event mEvent;
                while (mWindow.pollEvent(mEvent)){
                        if (mEvent.type == sf::Event::Closed ||
                                ((mEvent.type == sf::Event::KeyPressed) && (mEvent.key.code == sf::Keyboard::Escape))){
                                mWindow.close();
                        }
                }
                mWindow.clear();
                mWindow.display();
        }

        return 0;
}
 

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #207 on: May 15, 2013, 03:39:44 am »
LTBL needs C++11 in order to compile. Try compiling it again with C++11 features enabled.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

dragondgold

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Email
Re: SFML Light System - Let There Be Light
« Reply #208 on: May 15, 2013, 03:47:55 am »
LTBL needs C++11 in order to compile. Try compiling it again with C++11 features enabled.

I get this errors compiling with C++11

make all
Building file: ../src/PruebaLightSFML.cpp
Invoking: GCC C++ Compiler
g++ -I/home/andres/Dropbox/Development/SFML-2.0/include -I/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source -O0 -g3 -Wall -c -fmessage-length=0 -std=c++0x -MMD -MP -MF"src/PruebaLightSFML.d" -MT"src/PruebaLightSFML.d" -o "src/PruebaLightSFML.o" "../src/PruebaLightSFML.cpp"
In file included from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTreeNode.h:4:0,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/QuadTree.h:4,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/QuadTree/StaticQuadTree.h:4,
                 from /home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Light/LightSystem.h:30,
                 from ../src/PruebaLightSFML.cpp:7:
/home/andres/Dropbox/Development/Let_There_Be_Light_v1.5.1/Source/LTBL/Constructs/AABB.h:54:15: warning: class ‘AABB’ is implicitly friends with itself [enabled by default]
../src/PruebaLightSFML.cpp: In function ‘int main()’:
../src/PruebaLightSFML.cpp:29:2: error: ‘Light_Point’ was not declared in this scope
../src/PruebaLightSFML.cpp:29:15: error: ‘testLight’ was not declared in this scope
../src/PruebaLightSFML.cpp:29:31: error: expected type-specifier before ‘Light_Point’
../src/PruebaLightSFML.cpp:29:31: error: expected ‘;’ before ‘Light_Point’
make: *** [src/PruebaLightSFML.o] Error 1

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: SFML Light System - Let There Be Light
« Reply #209 on: May 15, 2013, 04:33:51 am »
You have to #include <LTBL/Light/Light_Point.h>
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

 

anything