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

Pages: [1]
1
General discussions / Re: Slow performance with Raspberry PI 3B
« on: October 20, 2019, 11:31:19 am »
Okay, after advise on IRC I compiled master version. Performance jumped directly to min 25  fps! I needed only replace Quads with TriangleFan. Thanks.

2
General discussions / Re: Slow performance with Raspberry PI 3B
« on: October 19, 2019, 11:41:40 pm »
I managed to compile and install SFML with OpenGL ES, game compiles but crashing on the linking, any tips?:

[  2%] Linking CXX executable DeerPortal
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::cleanup()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::update()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::getCapabilities() const'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::getTouchPosition(unsigned int, sf::Window const&)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::setEnabled(bool)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::initialize()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::update()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::CursorImpl::~CursorImpl()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::isConnected(unsigned int)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::WindowImplRPi::WindowImplRPi(unsigned long)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::WindowImplRPi::WindowImplRPi(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&)'                                        
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::setMousePosition(sf::Vector2<int> const&, sf::Window const&)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::setMousePosition(sf::Vector2<int> const&)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::VideoModeImpl::getFullscreenModes()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::isTouchDown(unsigned int)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::CursorImpl::loadFromPixels(unsigned char const*, sf::Vector2<unsigned int>, sf::Vector2<unsigned int>)'
                                           
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::close()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::JoystickImpl()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::setVirtualKeyboardVisible(bool)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::initialize()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::VideoModeImpl::getDesktopMode()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::getMousePosition(sf::Window const&)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::ClipboardImpl::getString()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::close()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::isAvailable(sf::Sensor::Type)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::getMousePosition()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::isMouseButtonPressed(sf::Mouse::Button)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::cleanup()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::getTouchPosition(unsigned int)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::open(sf::Sensor::Type)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::isKeyPressed(sf::Keyboard::Key)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::open(unsigned int)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::ClipboardImpl::setString(sf::String const&)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::getIdentification() const'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::CursorImpl::loadFromSystem(sf::Cursor::Type)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::CursorImpl::CursorImpl()'

collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/DeerPortal.dir/build.make:584: DeerPortal] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/DeerPortal.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
 

3
General discussions / Re: Slow performance with Raspberry PI 3B
« on: October 19, 2019, 02:38:22 pm »
So, I checked and actually it was using default OpenGL - it seems a default libfsfml packages configuration on Raspbian.

I am trying to compile sfml with OpenGL ES, but for now it is crashing:

[ 16%] Built target sfml-system
Scanning dependencies of target sfml-window
[ 17%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/GlContext.cpp.o
In file included from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/GlContext.cpp:73:
/tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EglContext.hpp:165:12: error: ‘XVisualInfo’ does not name a type
     static XVisualInfo selectBestVisual(::Display* display, unsigned int bitsPerPixel, const ContextSettings& settings);
            ^~~~~~~~~~~
make[2]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/build.make:102: src/SFML/Window/CMakeFiles/sfml-window.dir/GlContext.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:176: src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
 

I found XVisualInfo in several places in system libs:

/usr/include/X11/Xutil.h:} XVisualInfo;
/usr/include/X11/Xutil.h:extern XVisualInfo *XGetVisualInfo(
/usr/include/X11/Xutil.h:    XVisualInfo*       /* vinfo_template */,
/usr/include/X11/Xutil.h:    XVisualInfo*       /* vinfo_return */
/usr/include/GL/glx.h:extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
/usr/include/GL/glx.h:extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
/usr/include/GL/glx.h:extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
/usr/include/GL/glx.h:extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
/usr/include/GL/glx.h:extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
/usr/include/GL/glx.h:typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
/usr/include/GL/glxext.h:typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
/usr/include/GL/glxext.h:XVisualInfo *glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config);
/usr/include/GL/glxext.h:typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
/usr/include/GL/glxext.h:GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
/usr/include/GL/glxext.h:typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
/usr/include/GL/glxext.h:typedef GLXFBConfigSGIX ( *PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
/usr/include/GL/glxext.h:XVisualInfo *glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config);
/usr/include/GL/glxext.h:GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis);
/usr/include/glvnd/libglxabi.h:     * for the XVisualInfo or GLXFBConfig that the context is created from.
 

but nothing in the special Raspberry drivers.

Including X11/Xutil.h results with:

[ 17%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/GlContext.cpp.o
[ 18%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/WindowImpl.cpp.o
[ 19%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/EglContext.cpp.o
In file included from /usr/include/X11/Xlib.h:44,
                 from /usr/include/X11/Xutil.h:53,
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EGLCheck.hpp:34,                                                                                                                                                          
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EglContext.hpp:33,                                                                                                                                                        
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EglContext.cpp:29:                                    
/tmp/libsfml-2.5.1+dfsg/include/SFML/Window/WindowStyle.hpp:40:9: error: expected identifier before numeric constant
         None       = 0,      ///< No border / title bar (this flag and all others are mutually exclusive)
         ^~~~                                                                                                
/tmp/libsfml-2.5.1+dfsg/include/SFML/Window/WindowStyle.hpp:40:9: error: expected ‘}’ before numeric constant
In file included from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/Unix/CursorImpl.hpp:34,
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/CursorImpl.hpp:39,
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/WindowImpl.hpp:35,
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EglContext.cpp:30:        
/tmp/libsfml-2.5.1+dfsg/include/SFML/Window/WindowStyle.hpp:39:5: note: to match this{
     {
     ^                                          
In file included from /usr/include/X11/Xlib.h:44,
                 from /usr/include/X11/Xutil.h:53,                            
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EGLCheck.hpp:34,  
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EglContext.hpp:33,
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EglContext.cpp:29:                                                                                                                                                      
/tmp/libsfml-2.5.1+dfsg/include/SFML/Window/WindowStyle.hpp:40:9: error: expected unqualified-id before numeric constant                                                                                                              
         None       = 0,      ///< No border / title bar (this flag and all others are mutually exclusive)
         ^~~~                                                                        
In file included from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/Unix/CursorImpl.hpp:34,
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/CursorImpl.hpp:39,
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/WindowImpl.hpp:35,
                 from /tmp/libsfml-2.5.1+dfsg/src/SFML/Window/EglContext.cpp:30:                              
/tmp/libsfml-2.5.1+dfsg/include/SFML/Window/WindowStyle.hpp:50:1: error: expected declaration before ‘}’ token
 } // namespace sf
 ^                                                                                                                                                                                                                                    
make[2]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/build.make:271: src/SFML/Window/CMakeFiles/sfml-window.dir/EglContext.cpp.o] Error 1                                                                                          
make[1]: *** [CMakeFiles/Makefile2:176: src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
make: *** [Makefile:130: all] Error 2  
 

I will keep looking, but any help appreciated.


4
General discussions / Slow performance with Raspberry PI 3B
« on: October 18, 2019, 11:12:40 pm »
Hello,

I have recently updated Raspbian on my Pi3B, and I have noticed that libsfml is included in the repositories.

I have managed to compile my project pretty much without any hustle, but then I noticed dramatic decrease of performance - game is not responsive at all, latency events/mouse clicks can be around 0.5s, and it pushed me to measure frames - and I got ~5fps... On laptop the game has few hundres fps, on workstation with Nvidia 1030 2-3k.

And this is not some sophisticated game - pretty simple board game, with main code happening here: https://github.com/deerportal/deerportal/blob/master/src/game.cpp

Does someone have experience with porting sfml projects to Pi and how they work?

Any help/comments appreciated.

bluszcz


5
Graphics / Re: Array of shapes
« on: October 18, 2019, 11:05:07 pm »
Long time, but, since I am optimizing now my game - I was trying to do so by changing way of iterating.

So, due to my Visual Studio profiler - when using auto c++11 vs using index, auto construction is slower by about 5% (and I fps are going down from ~2000 to 1500) - I am drawing about 120  sprites...

Using the STL, you can have an array (or vector) of objects, thus:
class Alien; // define your Alien

std::vector<Alien> aliens(20); // create 20 aliens (this could instead be just a vector of sf::Sprites or sf::RectangleShapes or whatever if the only thing the aliens need is their appearance)

// ...

// draw all aliens
for (auto& alien : aliens)
    window.draw(alien);

If you're unable to use C++11 (or later) for whatever reason, to iterate the aliens (to draw them as above), you'd need to access them via iterator:
for (std::vector<Alien>::iterator it = aliens.begin(); it != aliens.end(); ++it)
    window.draw(*it);
or index:
for (unsigned int i = 0u; i < aliens.size(); ++i)
    window.draw(aliens[i]);


For more information about some of the STL containers (e.g. vectors), have a look at the following pages:
VECTOR:
http://www.cplusplus.com/reference/vector/vector/
http://en.cppreference.com/w/cpp/container/vector
ARRAY:
http://www.cplusplus.com/reference/array/array/
http://en.cppreference.com/w/cpp/container/array

Pages: [1]
anything