Giter Site home page Giter Site logo

sfml / sfml Goto Github PK

View Code? Open in Web Editor NEW
9.6K 345.0 1.6K 102.61 MB

Simple and Fast Multimedia Library

Home Page: https://www.sfml-dev.org/

License: zlib License

CMake 3.36% C++ 87.80% Objective-C 1.78% Objective-C++ 6.82% Shell 0.17% GLSL 0.06%
sfml c-plus-plus multimedia games opengl sdk graphics audio cross-platform hacktoberfest

sfml's Introduction

SFML logo

SFML — Simple and Fast Multimedia Library

SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python.

State of Development

Development is focused on the next major version in the master branch. No more features are planned for the 2.x release series.

  • The master branch contains work in progress for the next major version SFML 3. As such it's considered unstable, but any testing and feedback is highly appreciated.
  • The 2.6.0 tag is the latest official SFML release and will be the last minor release in the 2.x series.

CMake Template

The easiest way to get started with SFML is our CMake-based project template. This template will automatically download and build SFML alongside your own application. Read the README for full instructions on how to use it.

Download

  • You can get the latest official release on SFML's website.
  • You can also get the source code of the current development version from the Git repository.
  • Alternatively, you can get the latest snapshot / artifact builds from the artifacts storage.

Install

Follow the instructions of the tutorials, there is one for each platform/compiler that SFML supports.

Learn

There are several places to learn SFML:

Community

Here are some useful community links:

Contribute

SFML is an open-source project, and it needs your help to go on growing and improving. If you want to get involved and suggest some additional features, file a bug report or submit a patch, please have a look at the contribution guidelines.

Authors

License

The SFML libraries and source code are distributed under the zlib/libpng license. See license.md. External libraries used by SFML are distributed under their own licenses.

In short, SFML is free for any use (commercial or personal, proprietary or open-source). You can use SFML in your project without any restriction. You can even omit to mention that you use SFML -- although it would be appreciated.

External libraries used by SFML

sfml's People

Contributors

acsbendi avatar amdmi3 avatar binary1248 avatar bromeon avatar ceylo avatar christhrasher avatar cschreib avatar dogunbound avatar eliasdaler avatar elijahfhopp avatar expl0it3r avatar foaly avatar gnawme avatar hobby8 avatar intjelic avatar jcowgill avatar jim-marsden avatar jonnyptn avatar jqdg avatar kimci86 avatar laurentgomila avatar mantognini avatar marioliebisch avatar oomek avatar pparuzel avatar sakarah avatar si1ver avatar tankos avatar texus avatar vittorioromeo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sfml's Issues

Portability : Mobiles Device (OpenGL ES) and Web support (WebGL)

SFML is really perfect that any other low-level libraries at many many points.

The last thing missing is about its portability (Android, WinCE, iOS, maybe consoles).

I saw several topics about this on the project forums and with mobile devices and web features marketing who growing up everydays actually, I think this is a critical thing to do and that will give to SFML and their users more credits and possibility to code new great products.

Thanks.

Input should be Copyable

I did a search but was surprised that this haven't been taken up before(at least of what I found).

I understand why Input is NonCopyable because the intended use is:

sf::Input &input = window.GetInput()

We want the input object to be linked to the window.

But when it comes to threads I only want snapshots of the current input state. While still being able to pull more events from the window without interfering with the other thread(s) using input. I could easily implement my own class for that which wraps around sf::Input but it felt unnecessary. Because it would simplify a lot with just being able to do this:


sf::Input inputState = myWindow.GetInput();
myOutput.GetList()->AddMessage( inputState );

instead of having to:

sf::Input &inputState = myWindow.GetInput();
myOutput.GetList()->AddMessage( InputWrapper( inputState ) );

The point being, I feel that being able to copy sf::Input objects is valid and should be supported.

Implement a new API for drawables

Implement a more flexible API, that allows users to build their own geometry.
The new API should give access to low-level concepts: primitive type (points/lines/triangles/quads), vertices' attributes (position/color/texture coordinates), buffer type (static/dynamic).

The most difficult part of this task is to find how to mix the new API with the current one, based on high-level objects (sprite/text/shape).

Add bool sf::Image::IsEmpty()

Add bool sf::Image::IsEmpty(). Returns true is no image is loaded into it.

bool Image::IsEmpty() const {
{
    // First check if the array of pixels needs to be updated
    EnsureArrayUpdate();
    return myPixels.empty();
}

sf::Vector2: Conversion operators between int and float

With conversion operators between sf::Vector2i and sf::Vector2f users of sfml no longer have to write ugly things like sf::Vector2f(static_cast(iVec.x), static_cast(iVec.y)).
static_castsf::Vector2f(iVec) is shorter, nicer and avoids the risk to swap x and y by mistake.

Manage Joysticks

Write some code to manage Joysticks on Mac the same way SFML handle them on Linux and Windows. (10.5 and later only)

Implement rendering masks

Add a sf::ClippingMask class, which is used to clip rendered objects to a specific region of 2D world.

There are many OpenGL options to implement it, the best one should be clip planes.

delete sf::Text causing Debug Assertion Failed

It appears that when trying to delete an instance of sf::Text a Debug Assertion Failed is thrown, using this sample code from the latest source seems to create the error:

    sf::Text *text2 = new sf::Text();

    while (window.IsOpened())
    {
        sf::Event new_event;
        while (window.PollEvent(new_event))
        {
            switch (new_event.Type)
            {
            case sf::Event::Closed:
                window.Close();
            }
        }

        window.Clear();
        window.Display();
    }

    delete text2;

Add number conversion functions to sf::String

Add number conversion functions to sf::String

To improve the manipulation of strings, would it be possible to add these functions :

static sf::String Number(unsigned int n, int base = 10);
static sf::String Number(int n, int base = 10);
static sf::String Number(unsigned long n, int base = 10);
static sf::String Number(long n, int base = 10);
static sf::String Number(float n, int precision = 2, int format = fixed);
static sf::String Number(double n, int precision = 2, int format = fixed);

code sample :

#include <sstream>

class (...)
{
    enum Number_formats
    {
        fixed,          // 9.99
        scientific,     // 9.9e9
        Scientific      // 9.9E9
    };

    static sf::String Number(unsigned int n, int base = 10)
    {
        std::ios::fmtflags flagBase = (base == 8 ? std::ios::oct : (base == 16 ? std::ios::hex : std::ios::dec));

        std::stringstream number;

        number.flags(flagBase | std::ios::showbase);

        number << n;

        return sf::String(number.str());
    }

    static sf::String Number(float n, int precision = 2, int format = f)
    {
        std::ios::fmtflags flagFormat = (format == fixed ? std::ios::fixed : std::ios::scientific);

        if (format == Scientific) flagFormat |= std::ios::uppercase;

        std::stringstream number;

        number.flags(flagFormat);
        number.precision(precision);

        number << n;

        return sf::String(number.str());
    }
};

(Sorry for the labels, i don't understand how to put them on this issue...)

sf::Event::KeyEvent::System field

Add a System field to sf::Event::KeyEvent structure in order to keep track on key pressed/released event on this special key (very useful on Mac, and why not on Windows and Linux ?)

Access Violation error in the destructor of sf::AudioDevice

Access Violation error occurs int the destructor of sf::AudioDevice on Windows XP SP3. It doesn't occur on Windows 7 and Windows Vista.

Here is the instruction pointed by the visual C++ 2008 debugger:

Code:

AudioDevice::~AudioDevice() 
{ 
    // Destroy the context 
    alcMakeContextCurrent(NULL); 
    if (audioContext) 
=>           alcDestroyContext(audioContext); 

    // Destroy the device 
    if (audioDevice) 
        alcCloseDevice(audioDevice); 
} 

The error can be reproduced with this simple code :

#include <SFML/Audio.hpp> 

int main() 
{ 
    sf::Sound Sound; 

    return EXIT_SUCCESS; 
} 

This problem was first discussed in this post of the french forum :
http://www.sfml-dev.org/forum-fr/viewtopic.php?t=3443

Make SFML work with FPS like camera in OSX

This is my first bug report in ages so bear with me...

The typical way of getting cursor delta positions and re-centering the cursor each frame to get FPS like input doesn't work well with SFML in OSX.

The problem appears to be that CGDisplayMoveCursorToPoint() causes the cursor to come to a complete stop for a second or two before it can move again. It's as if it loses all it's current speed and has to re-accelerate again from 0.

In a situation where you compare the cursor's current position with the one it had the previous frame and then re-center it, you can only get a couple of pixels of movement each second (1-5 pixels in either direction, depending on how violently you move the mouse).

Finding a way to position the cursor without causing it to decellerate completely seems to be the only solution.

In an attempt to not sound more confusing I'll just link to the thread I created about this in the forums: http://www.sfml-dev.org/forum/viewtopic.php?p=31550#31550

Change FlipX FlipY functions

I realize that sf::Sprite::FlipX and FlipY doesn't really fit in with the rest of the sprite class. All of the other methods are mainly Get and Set. I think we should do a SetFlipX, SetFlipY, SetFlip (X + Y). Also add a GetFlipX and GetFlipY.

Hanging when destroying GlContext

Whenever a GlContext is destroyed the entire thread hangs, as demonstrated by this program:

#include <SFML/Window.hpp>

int main(void)
{
  {
    sf::Window window(sf::VideoMode(100, 100), "Test");
  }
  return 0;
}

I've found the place it hangs to be on line 126 in SFML/Window/GlContext.cpp. This was working before commit fd0d18f12e0793911ea560f7afc4c79f4421f70c.

sf::Thread: Possible issue with uninitialized variables

The class sf::Thread does not define a constructor, but it has member variables like priv::ThreadImpl* myImpl. I think, it is undefined, with what value they are initialized when an instance of sf::Thread is created. If the user calls for example sf::Thread::Wait() whithout having called sf::Thread::Launch() before, this can result in an error because the check for myImpl being NULL fails.

Memory management of objects using background threads are broken in GCed runtimes

I'm writing Haskell bindings to SFML and encountered a problem with memory management of objects that start background threads. I'm going to use Music as an example.

When you call Music.Play() it spawns a new thread and does its work there. The problem is that in GCed environments the GC doesn't know about the new thread. If the object falls out of scope within the runtime, the GC will collect it, causing the destruction of the object in the spawned thread as well.

I've been using the C# bindings as an example of bindings to a GCed runtime, and was able to reproduce the problem there with this program:

using System;
using System.Threading;

using SFML.Audio;

namespace SFMLtest
{
  public class MainApp
  {
    public static void Main (string[] args)
    {
      System.Console.WriteLine("Now playing");
      StartMusic();

      Thread.Sleep( 5000);

      System.Console.WriteLine("Running garbage collection");
      GC.Collect();

      Thread.Sleep( 5000);
      System.Console.WriteLine("Y U NO PLAY MUSIC ANYMORE?");
    }

    private static void StartMusic() {
      new Music("Music.ogg").Play();
    }
  }
}

My suggestion for a fix would be to allow users to "start" these objects without spawning a new thread. It would then be the responsibility of the binding libraries to spawn new threads as needed, allowing GCed runtimes to spawn threads the GC will take into account when collecting garbage.

Anti-aliasing broken - or rather, mechanism for picking the best visual is

As per this thread the GlxContext::CreateContext function, while apparently able to pick the best visual for other given properties such as resolution and bit-depth, doesn't seem to honor the multisampling setting even on system that have those visuals available.

In fact, from hacking the code a little it seems to effectively always pick the first one (of glxinfo). Perhaps this function should be improved so that systems whose first visual doesn't support multisampling can also benefit from multisampling.

std::basic_string crash

Crash with malloc: *** error for object 0x...: pointer being freed was not allocated

See http://www.sfml-dev.org/forum-fr/viewtopic.php?p=30752#30752 (french) for more details (and potential solutions).

(Bug reported to Apple on 10 February 2011)

Here is a MCRP as of adca580 :

#include <SFML/System.hpp> 
int main() 
{ 
    sf::String s; 
    return 0; 
} 

and the backtrace (OS X 10.7.2, GCC or Clang from Xcode 4.2.1) :

(gdb) backtrace
#0  0x00007fff8d51982a in __kill ()
#1  0x00007fff91cada9c in abort ()
#2  0x00007fff91d0c84c in free ()
#3  0x00000001000019dd in __gnu_cxx::new_allocator<char>::deallocate (this=0x7fff5fbff8a0, __p=0x10000a2b0 "") at new_allocator.h:97
#4  0x0000000100001938 in std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::_Rep::_M_destroy (this=0x10000a2b0, __a=@0x7fff5fbff910) at basic_string.tcc:430
#5  0x0000000100001789 in std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::_Rep::_M_dispose (this=0x10000a2b0, __a=@0x7fff5fbff910) at basic_string.h:237
#6  0x00000001000016a0 in std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::~basic_string (this=0x7fff5fbff9b0) at basic_string.h:492
#7  0x0000000100001655 in std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::~basic_string (this=0x7fff5fbff9b0) at basic_string.h:492
#8  0x0000000100001635 in sf::String::~String (this=0x7fff5fbff9b0) at String.hpp:43
#9  0x0000000100001615 in sf::String::~String (this=0x7fff5fbff9b0) at String.hpp:43
#10 0x0000000100001546 in main () at /Users/marcoantognini/Prog/Cpp/Test/SFML/test/test/main.cpp:7

Current workaround :
Add -D_GLIBCXX_FULLY_DYNAMIC_STRING=1 to CMAKE_CXX_FLAGS.

This solution is not officially implemented because I don't know the potential drawbacks.

X Error of failed request: GLXBadContext

So I get this error when I try to run the "window" example with a freshly compiled SFML2:

X Error of failed request: GLXBadContext
Major opcode of failed request: 154 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Serial number of failed request: 25
Current serial number in output stream: 30

No window opens it just crashes with the above message.
I tried the "window" example from 1.6.3 and it works(with SFML1.6.3)

Some information about my system:

direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD RV710
OpenGL version string: 2.1 Mesa 7.10.2
OpenGL shading language version string: 1.20
OpenGL extensions:
01:00.0 VGA compatible controller: ATI Technologies Inc M92 [Mobility Radeon HD 4500 Series]
Linux ganymede 2.6.38-ARCH #1 SMP PREEMPT Tue May 10 08:05:04 CEST 2011 x86_64 Pentium(R) Dual-Core CPU >T4200 @ 2.00GHz GenuineIntel GNU/Linux

I'm using the open source ati drivers.

Hope this is easy to fix. If you need more information just tell me!
Looking forward to finally use SFML2 :)

Split sf::Image into sf::Image and sf::Texture

sf::Image is a monolithic class that has too many features. This makes it hard to maintain, and creates unnecessary limitations.

There should be two separate classes:

  • sf::Image, a pixel buffer in RAM that can be manipulated freely
  • sf::Texture, an image uploaded as a texture on the graphics card

The main benefits of doing so are:

  • we can put more features in each class since it only has one specific role
  • we can avoid storing the pixels of a texture in RAM if we don't need them
  • we can have no limit on the size of sf::Image, only on sf::Texture
  • people using raw OpenGL can create their own textures from images without having to load a SFML texture first
  • ...

Drawable classes would use sf::Texture, sf::Image would be used only for extra image manipulations such as saving to a file, creating an alpha channel, changing pixels, etc.

Conversions between both classes must be straight-forward (from the public API point of view).

sf::RenderImage would have to be renamed to sf::RenderTexture.

Improve keyboard handling

Uniformly manage all keyboards accordingly to their localization.

A (partial) implementation can be found in PR #568, however:

Its purpose is to be a workaround for the ones in need of scancodes support before the official implementation. And I would be glad if it could help the SFML devs during the creation of the official implementation as well.

Transform mouse coordinates in resized window

Currently, after resizing a window, the mouse coordinates in an sf::Event::MouseMove structure are absolute window positions, but graphics are scaled. This is confusing and inconsistent.

My proposal is to either transform mouse coordinates to fit the new scale or change the sf::View automagically.

Example to reproduce:

#include <SFML/Graphics.hpp>
#include <iostream>

int main() {
    sf::RenderWindow window( sf::VideoMode( 800, 600, 16 ), "Resizing sample" );
    sf::Shape rect( sf::Shape::Rectangle( 5.f, 5.f, 790.f, 590.f, sf::Color( 255, 255, 255 ) ) );

    sf::Event event;

    while( window.IsOpened() ) {
        while( window.PollEvent( event ) ) {
            if( event.Type == sf::Event::Closed ) {
                window.Close();
            }
            else if( event.Type == sf::Event::MouseMoved ) {
                std::cout << event.MouseMove.X << ", " << event.MouseMove.Y << std::endl;
            }
        }

        window.Clear();
        window.Draw( rect );
        window.Display();
    }

    return 0;
}

sf::Vector2i: Make use of it

At the moment, SFML does not use sf::Vector2i. Instead there are function pairs like sf::Image::GetWidth() and sf::Image::GetHeight(). I suggest, to change them to sf::Image::GetSize() returning an sf::Vector2i.

The usage of sf::Vector2i fits better to other parts of SFML which use consistently sf::Vector2f. Furthermore, It requires less function calls (because usually you want the X and the Y value of a point and not just one of them).

Examples where SFML should use sf::Vector2i:

  • sf::Event::MouseButtonEvent::X, ::Y
  • sf::Event::MouseWheelEvent::X, ::Y
  • sf::Event::MouseMoveEvent::X, ::Y
  • sf::Image::GetWidth(), ::GetHeight()
  • sf::Image::SetPixel
  • sf::Image::GetPixel
  • sf::RenderTarget
  • sf::RenderTarget::GetWidth(), ::GetHeight()
  • sf::RenderTarget::ConvertCoords
  • sf::Sprite::GetPixel

If I find more examples, I will add them to this issue.

SFML2 MinGW make problem.

I have just downloaded the latest snapshot of SFML2. Configured it with cmake for MinGW under Windows 7 to build shared libs. This was successful but when I try to compile it with make it does nothing but printing out the version of my windows and a legal notice. Here is what did I do in the MinGW console:

TomCatFort@TomCatFort-LAP ~
$ cd /s/Projects/___LIBS_N_X/SFML2_snap/build/mingw-r/
TomCatFort@TomCatFort-LAP /s/Projects/___LIBS_N_X/SFML2_snap/build/mingw-r
$ ls
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake lib src
TomCatFort@TomCatFort-LAP /s/Projects/___LIBS_N_X/SFML2_snap/build/mingw-r
$ make
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
s:\Projects___LIBS_N_X\SFML2_snap\build\mingw-r>

As it looks like, I end up with nothing but a cmd.exe instance running in the terminal. The lib directory it creates is empty.

sf::Vector2i: Overload functions taking vectors

It would be good, if functions like sf::Rect::Contains(const sf::Vector2f&) were overloaded for const sf::Vector2i.
This can be useful for example if someone packs mouse coordinates (which are integers) to a Vector2i and tries to find out if the mouse is inside a rectangle.

shader example doesn't work on mac

I've tested the shader example on two mac (macbook mid2007(intel GMA 950) and imac end2009(Ati Radeon HD 4760)). On both some shader can't be builded :

Failed to compile shader:
ERROR: 0:9: '*' :  wrong operand types no operation '*' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:10: '*' :  wrong operand types no operation '*' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:11: '*' :  wrong operand types no operation '*' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:12: '*' :  wrong operand types no operation '*' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:13: '*' :  wrong operand types no operation '*' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'const int' (or 

SFML2 looping too quickly (Linux, NVIDIA)

By default, all programs including the examples will run too quickly for the window on this computer, it appears. The FPS is extremely low but the update time is extremely fast.

It would appear that SFML isn't waiting for the window to finish rendering before continuing to the next loop.

Adding usleep(1000) somewhere in the loop fixes this problem, waiting 1 millisecond to let the window render. Not the best fix though.

Bug when rendering images loaded from another thread

This a sum up of the original discussion created here : http://www.sfml-dev.org/forum-fr/viewtopic.php?t=3455 (french)

The issue: sprites may not be displayed depending on how they are used. More precisely, they are not displayed when the image data is loaded from another thread and some time elapses between the sf::Sprite::Draw() call and sf::Window::Display().

This bug has been tested on an Intel MacBook with an Intel GMA X3100 graphics card, on both Windows, Linux and Mac OS X. The bug happens on Window and Linux only. It's been tested with the latest sources from the Git repository, in both Release and Debug mode.

Here are the two most important sample codes:
http://www.sfml-dev.org/forum-fr/viewtopic.php?p=33557#33557

http://www.sfml-dev.org/forum-fr/viewtopic.php?p=33563#33563

On Windows, the image won't show if:

  • we're sleeping a little bit after the Draw() call
  • we're using UpdatePixels() instead of Create()/LoadFromFile()

On Linux, it's little bit more.. rough, it'll either show correctly or crash.
With Create/Load:

  • without sleeping: a.out: ../../intel/intel_bufmgr_gem.c:344: drm_intel_gem_bo_reference: Assertion '((&bo_gem->refcount)->atomic) > 0' failed.
  • with sleeping: a.out: ../../intel/intel_bufmgr_gem.c:452: drm_intel_bo_gem_set_in_aperture_size: Assertion '!bo_gem->used_as_reloc_target' failed.

a.out: ../../intel/intel_bufmgr_gem.c:344: drm_intel_gem_bo_reference: Assertion `((&bo_gem->refcount)->atomic) > 0' failed.

With Update..():

  • without sleeping:

0 0x0097e0ca in ?? () from /usr/lib/dri/i965_dri.so
1 0x0097649c in ?? () from /usr/lib/dri/i965_dri.so
2 0x008a15c7 in ?? () from /usr/lib/dri/i965_dri.so
3 0x008a19e6 in ?? () from /usr/lib/dri/i965_dri.so
4 0x0096bb2b in ?? () from /usr/lib/dri/i965_dri.so
5 0x00160844 in sf::Image::UpdatePixels(unsigned char const*) () from /usr/local/lib/libsfml-graphics.so.2.0
6 0x0804929d in thread_func () at sf.cpp:14
7 0x0804991e in sf::priv::ThreadFunctor<void (*)()>::Run (this=0x85a9f28) at /usr/local/include/SFML/System/Thread.inl:39
8 0x00134b44 in sf::Thread::Run() () from /usr/local/lib/libsfml-system.so.2.0
9 0x001350d1 in sf::priv::ThreadImpl::EntryPoint(void*) () from /usr/local/lib/libsfml-system.so.2.0
10 0x00475cc9 in start_thread () from /lib/libpthread.so.0
11 0x003e369e in clone () from /lib/libc.so.6

  • with sleeping: runs fine but crashes at exit with:
    ../../intel/intel_bufmgr_gem.c:1077: Error setting domain 7: Bad file descriptor
    DRM_IOCTL_GEM_CLOSE 6 failed (region): Bad file descriptor

Outdated MinGW external libraries

The "extlibs/libs-mingw/libjpeg.a" does not fit to the "extlibs/headers/jpeg/jpeglib.h" header file.

Versions:

  • libjpeg.a - 62
  • jpeglib.h - 80

The error can be reproduced with this code. It occurs when this is compiled with mingw but also could occur when using other compilers (it really depends on the compiler you create SFML with, I think)

#include <SFML/Graphics.hpp>

int main ()
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Screenshot");
    App.SetFramerateLimit(30);

    while (App.IsOpened())
    {
        // Event
        sf::Event Event;
        while(App.PollEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();

            if (Event.Type == sf::Event::KeyReleased && Event.Key.Code == sf::Key::Space)
            {
                sf::Image Screenshot;
                Screenshot.CopyScreen(App);
                Screenshot.SaveToFile("test.jpg");
            }
        }

        // Render
        App.Clear(sf::Color(0, 0, 0, 255));
        App.Display();
    }
    return 0;
}

Error Message printed when releasing space:

Wrong JPEG library version: library is 62, caller expects 80

Should be fixed by updating the libjpeg.a file.

Can't build on OSX

It is currently not possible to build SFML on OSX, due to some methods of SFContext that were not implemented:

[ 18%] Built target sfml-system
[ 19%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.d/GlContext.cpp.o
/Users/kilian/SFML/src/SFML/Window/GlContext.cpp: In static member function ‘static sf::priv::GlContext* sf::priv::GlContext::New(const sf::ContextSettings&, const sf::priv::WindowImpl*, unsigned int)’:
/Users/kilian/SFML/src/SFML/Window/GlContext.cpp:143: error: no matching function for call to ‘sf::priv::SFContext::SFContext(ContextType*&, const sf::ContextSettings&, const sf::priv::WindowImpl*&, unsigned int&)’
/Users/kilian/SFML/src/SFML/Window/OSX/SFContext.hpp:82: note: candidates are: sf::priv::SFContext::SFContext(sf::priv::SFContext*, const sf::priv::WindowImpl*, unsigned int, const sf::ContextSettings&)
/Users/kilian/SFML/src/SFML/Window/OSX/SFContext.hpp:70: note:                 sf::priv::SFContext::SFContext(sf::priv::SFContext*)
/Users/kilian/SFML/src/SFML/Window/OSX/SFContext.hpp:62: note:                 sf::priv::SFContext::SFContext(const sf::priv::SFContext&)
/Users/kilian/SFML/src/SFML/Window/GlContext.cpp: In static member function ‘static sf::priv::GlContext* sf::priv::GlContext::New(const sf::ContextSettings&, unsigned int, unsigned int)’:
/Users/kilian/SFML/src/SFML/Window/GlContext.cpp:160: error: no matching function for call to ‘sf::priv::SFContext::SFContext(ContextType*&, const sf::ContextSettings&, unsigned int&, unsigned int&)’
/Users/kilian/SFML/src/SFML/Window/OSX/SFContext.hpp:82: note: candidates are: sf::priv::SFContext::SFContext(sf::priv::SFContext*, const sf::priv::WindowImpl*, unsigned int, const sf::ContextSettings&)
/Users/kilian/SFML/src/SFML/Window/OSX/SFContext.hpp:70: note:                 sf::priv::SFContext::SFContext(sf::priv::SFContext*)
/Users/kilian/SFML/src/SFML/Window/OSX/SFContext.hpp:62: note:                 sf::priv::SFContext::SFContext(const sf::priv::SFContext&)
make[2]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/GlContext.cpp.o] Error 1
make[1]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
make: *** [all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.