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.


Topics - Ceylo

Pages: 1 [2]
16
Window / Memory management of OpenGL objects with multithreading
« on: November 01, 2011, 06:27:04 pm »
Hello,

While working on sfeMovie I noticed a memory leak related to the OpenGL contexts.

I have 2 background threads where I do graphical work through the SFML Graphics package and I kill these threads when stopping the movie playback, and relaunch them when playing again.

I noticed a memory increase by around 10MB each time I restart the movie playback (stop [kill thread] + play [relaunch thread]). I can't remember how I thought of this but... if I manually declare a sf::Context object in each of the two thread functions, the memory leak is reduced by 90%. Thus I suppose that when exiting the background thread, the associated OpenGL context isn't properly released, whereas with the manual OpenGL context handling it's ok (I still need to figure out what's the remaining 10% leaking).

Isn't something going wrong in the SFML automatic OpenGL context handling?

Ceylo

PS: going to write a minimal code ASAP.

17
SFML projects / Awl - Asynchronous Work Library
« on: September 17, 2011, 02:18:30 pm »
Topic separated from http://www.sfml-dev.org/forum/viewtopic.php?p=38638#38638

Quote from: "Ceylo"
A little note to tell you I stop working on sfeMovie for, in order to work on another library: Awl. This library should allow me and others to work with parallel programming much more easily, and sfeMovie will be able to benefit from it. I've indeed been a little bit fed up of all the parallel programming issues I got with sfeMovie.

The repository : https://github.com/Yalir/Awl
A sample with SFML : http://pastebin.com/4SKHyAms


Quote from: "Hiura"
Well, good luck to you! Sounds great! ;-)

I'm wondering, is the paste bin example the definitive syntax (i.e. AwlAsyncBlock/AwlMainThreadBlock and AwlCloseAsyncBlock/AwlCloseMainThreadBlock pairs) or will you (perhaps) change it later ?


Quote from: "Ceylo"
Well.. yeah, I suppose this is the definitive syntax, and I can't find anything better as these are macros and thus need to be written as one word. Would you think of some other syntax ?

Moreover since yesterday there has been some additions and one now has:
AwlAsyncBlock
AwlCloseAsyncBlock
AwlCloseAsyncControlledBlock(taskRef) (gives back a Task object to allow cancelling/killing/waiting)

AwlAsyncCall(function)
AwlAsyncMethod(method, object)

AwlMainThreadBlock
AwlCloseAsyncMainThreadBlock (execute on main thread but don't wait for completion)
AwlCloseMainThreadBlock (execute on main thread and ensure completion before continuing)

AwlMainThreadCall(function)
AwlMainThreadMethod(method, object)

Hopefully I don't think there will be other macros like these, it seems enough to fit any situation.


Quote from: "Hiura"
Your syntax is not bad - you define a small DSL, that's it. However, if you want to keep the "C-like" syntax maybe the following could be a solution. I don't know exactly if it fits very well, though.



Code: [Select]
#define AwlAsyncBlock(functionBlock) \
{ \
    struct __awl_local_struct \
    { \
        static void __awl_async_block(void) \
        { \
            functionBlock \
        } \
    }; \
    awl::AsyncCall(boost::bind(__awl_local_struct::__awl_async_block)); \
}

:
:

AwlAsyncBlock
(
    tex1.LoadFromFile("big_image1.png");
    :
    :
)


So instead of using accolades you can use parenthesis.


Quote from: "Ceylo"
And no more closing macro needed. I like it. Actually what I would have really loved would be writing the same with { } and no closing macro, for two reasons: to explicitly keep the idea of block, and to ease indentation.

As for the latest point, with { } the block is correctly indented, whereas with ( ) it's indented by one space and the closing parenthesis is not aligned to the opening one. These are details but annoying details for everyday's programming.

But.. I could successfully try the following syntax:
Code: [Select]
AwlAsyncBlock
({
    // some code
})


Which is more interesting than with the close macro. Thanks!


Quote from: "Laurent"
I'm not sure that you can have a ';' inside a macro argument, it would mess up the code parser.

And I strongly encourage you to open a new topic about Awl instead of "polluting" the sfeMovie thread ;)


Quote from: "Hiura"
Quote from: "Laurent"
I'm not sure that you can have a ';' inside a macro argument, it would mess up the code parser.
Well, I just tested on gcc 4.2 and apple llvm compiler and both compiled the code fine. So apparently it works with these two at least.

18
General / Open discussion : parallel work libraries
« on: August 13, 2011, 12:38:03 pm »
Hello,

I'd like to start an open discussion about multithreading, parallelism and the libraries available today to achieve that work. This is not much related to SFML except its ease of use and probably some sfml-system classes that may be used in such library.

I'm creating this topic because I'm wondering whether an easy-to-use library to achieve this concept already exists, or whether it would have to be written, and how hard it would be.

The purposes of the library I'm looking for:
- accessible to most developers, not only to engineers or highly graduated persons
- available to C++ developers
- portable (start with Windows, Mac OS X and Linux, then extend to mobile devices)
- lightweight
- easy-to-use (related to accessibility)


The most important features I'm looking for:
- task parallelism
- task cancellation (in a soft and abrupt manner)
- task dependencies


The existing related libraries:
- Thread Building Blocks : really too complicated to use, and rather restrictive licence (GPL / commercial), it's the only library that I've found and that includes all of the features I'm looking for
- Grand Central Dispatch : currently not portable, not too complicated, no task cancellation (once started), no task dependencies, no automatic dependency support (only manual)
- PFunc : Unix only, still a bit complicated, no task dependency, no task cancellation
- Microsoft Task Parallel Library : MS platform and .NET only, no hard cancellation, restricted and manual task dependencies (one task cannot wake up more than one other task)
- OpenCL : not currently available on all platforms, not much more that an GPU parallel task library (not as high level as I would wish)
- OpenMP : widely supported except free versions of Visual Studio, no task cancellation nor automatic task dependencies


So what are your thoughts about all of these? Why do you think there are so few libraries corresponding to these needs? Or did I miss some great library? And do you think it would mean too much work to achieve one in a one-year basis?

The final purpose of this library, even if it's rather a dream, would be programming in a parallelized way as easily as you usually do with sequential programming.

Ceylo

19
SFML wiki / Wiki anchor links now prefixed with "wiki-" ?
« on: August 06, 2011, 11:26:35 am »
Just noticed that by having a look a the wiki : any link to an anchor in the page (starting with #...) is now prefixed with "wiki-". So all of these links are dead.

See the FAQ for example.

I suppose this is a GitHub change as there hasn't been any recent modification of the FAQ. Does one know whether it is a temporary change or whether all of the anchors should be updated?

20
SFML wiki / Condition class (synchronization between threads)
« on: June 01, 2011, 09:24:00 pm »
Helloo,

While working on sfeMovie, I've realised I was missing some powerful feature in order to properly handle threads' synchronization : conditions.

A condition is an object able to wait (block the current thread) until this condition is satisfied. As for this Condition class, it relies on integer values and therefore is able to wait until the condition reaches the requested value.

I'm posting here before publishing this work on the wiki in order to get your feedback. Note that I've made searches on conditions recently only, thus I'm absolutely not a conditions' expert. Therefore your feedback, even on extremely precise points is really welcome :) .

This class has been written in order to be able to handle conditions without having to use a "big" dependency (eg. boost).

The Condition class is made of 6 files you can download here: Condition.zip. There's no specific configuration settings, just put these files in your project and have fun :) .

Here's a little use example :
Code: [Select]
#include <SFML/System.hpp>
#include <iostream>
#include "Condition.h"

Condition cond;

void threadFunc()
{
    std::cout << "Thread launched" << std::endl;

    cond.waitForValueAndRetain(0); // Wait until the Condition reaches state 0
   
    std::cout << "Condition validated" << std::endl;
    // Do some protected work
    // ...
   
    cond.release(1); // Release the Condition in state 1
}


int main()
{
    sf::Thread th(threadFunc);
   
    cond = 1; // Set the Condition's state to 1
    th.Launch();
   
    sf::Sleep(...);
    cond = 0; // Change the Condition's state
   
    return 0;
}

21
SFML projects / Gas (simple particle system)
« on: January 20, 2011, 01:37:54 am »
Helloo!,


I'm posting now to introduce an... old project! I've written it with a friend of mine about 2 years ago in approximatively 2 days. I was, at this time, too lazy too post it here.

But! I've been talking again about it with this friend, thus I thought of showing it here again. And here it is, I hope you'll like it :) .

Don't expect much from it. It's just a simulation of the movements of some particles. You can change the strength of the interactions, invert the polarization or reset the speed of every particle. You can even get some weird shapes depending on your skill :P .



Sources (1.3 MB)
Binary for Windows (2.2 MB)
Binary for Linux (1.9 MB)
Binary for Mac OS X (4.9 MB)


Enjoy!

22
SFML wiki / sfeMovie project [v1.0 RC1 available]
« on: October 31, 2010, 06:38:42 pm »
Update from July 30th, 2012

sfeMovie 1.0 is available, see http://en.sfml-dev.org/forums/index.php?topic=8701.msg58578#msg58578


=============================

Update from March 15th, 2012

sfeMovie 1.0 RC1 is available, see http://www.sfml-dev.org/forum/viewtopic.php?p=48199#48199


=============================
Hello everyone,

Information update from 2011-05-12
I'm writing here to give you the latest news about the sfeMovie project.

sfeMovie is a small C++ library that lets you play movies in SFML based applications. It relies on SFML for the rendering process and FFmpeg for the decoding process. It supports both audio and video, and basic controls. This project has been written to work closely with SFML and tries to keep the same easy-to-use paradigm, while remaining coherent with SFML's conventions.


Information and download:
Most of the information is available through the wiki page, including the download links.

For now, sfeMovie is available to Windows and Mac OS X, and is in a beta state. Thanks to FFmpeg, sfeMovie can read many formats, including AAC, MP3, Vorbis, WMA, H.264, MPEG4, Theora, VP6 and WMV.
There is still a lot of work to do, but the current version already lets you use the main features.

I'm inviting you to test the library and write your feedback about bugs or any other issue you encountered. The bug tracker allows you to check the already-reported bugs or upcoming features and improvements.


As for the differences with the previous versions:
- all of the precompiled FFmpeg binaries have been dropped
- a script to compile everything for you has been added, it also allows you to exactly choose which decoders you want to enable
- FFmpeg is statically linked to sfeMovie, thus you don't have to care about FFmpeg dlls
- some minor bugs have been fixed


Ceylo


Original post:
Quote
Hellooo everyone,

I'm posting here to get some comments about a video class I'm currently working on. The purpose is to be able to display a video with its audio soundtrack, and to get something as easy to use as sf::Music.

It's supposed to work on all the OSs supported by SFML and has been currently successfully tested on Windows and Mac OS X. It uses SFML 1.6 and FFmpeg 0.6.1. It can be used to play videos but also to play music formats that are not supported by SFML (such as MP3).

Here is a short example on how to use the sfe::Video class :
Code: [Select]
int main()
{
    sf::RenderWindow window(sf::VideoMode(640, 480), "SFE Video");
    sfe::Video video;
   
    if (!video.OpenFromFile("video.avi"))
        return 1;
   
    video.Play();
   
    while (window.IsOpened())
    {
        sf::Event ev;
        while (window.GetEvent(ev))
        {
            if (ev.Type == sf::Event::Closed)
                window.Close();
        }
       
        window.Clear();
        window.Draw(video);
        window.Display();
    }
   
    return 0;
}

The sources, dependencies and project files (currently CodeBlocks 10.05 project for Windows and Xcode project for Mac OS X) can be downloaded from here.

Currently known issues :
- if your computer is too slow to decode the video, no video frame will be skiped, thus the video will get late
- video decoding is still not very efficient on high resolution videos on Windows (such as 1280x720)

Currently implemented features :
- video support with these formats* (short list) : FLV, H264, MPEG4, Theora, WMV
- audio support with these formats* (short list) : AAC, AC3, FLAC, MP3, PCM, Vorbis, WMA
- audio and video synchronization**
- getting some properties such as the video duration, size and framerate
- setting the sound volume
- scaling the video to fit a any frame (and every other sf::Drawable's features)
- basic video controls : play, pause, stop

Once the class gets stable enough, it'll be posted on the wiki :) .

* this list depends on the configuration options you use when building the FFmpeg binaries. It can includes GPL and non-free dependencies, but the default FFmpeg configuration is under the LGPL licence. See Video.h for a more detailed list of the video and audio formats supported with a basic build.

** video is synchronized until your CPU is fast enough to support the requested video framerate. If your CPU is faster, the video will keep a normal speed, but if it's too slow the video will get late. There is currently no support for skipping frames when the video decoding is late.

23
General discussions / [Mac OS X] SFML for Intel 64 bits
« on: January 31, 2010, 10:22:56 pm »
Hello everyone ! :D


Yersteday, in the SVN repository I put an Xcode project able to produce Intel 64 bits SFML frameworks. Instead of just having frameworks for PowerPC 32 bits and Intel 32, there is now the Intel 64 bits architecture included.

I've been able do to some testing and mostly everything works fine. So what's wrong... first of all, the 64 bits versions of the OS libraries are only provided since Mac OS X 10.5. This means only users running Mac OS X 10.5 and later will benefit from this update.

Moreover, as you may know, there was a bug with the OpenAL framework provided with Mac OS X 10.4, but not with the one provided with Mac OS X 10.5. And as the Mac OS X 10.5 and later users are the only ones that can benefit from this update, I will no more provide an OpenAL framework. The one provided with the OS will be used.

This means there won't be any OpenAL framework in the 64 bits package. And no more freetype library included in the frameworks too (you actually don't see it because it's statically linked, but this means the packages will be a bit lighter.

However, I noticed the OpenAL framework provided with Mac OS X does NOT support audio recording, and I'm actually unable to build the OpenAL framework for Intel 64 bits myself. If I don't find any answer, audio recording won't be supported for Intel 64 bits applications.

I also noticed some crashes with the FTP sample, but I think it's related the STL library provided with Mac OS X, so I'll probably not able to fix anything on this side.

"Otherwise" everything I tried works fine. But I still would like you to test the Intel 64 bits SFML frameworks in order to fix the other possibles bugs before SFML 1.6 is released.

Intel 64 bits frameworks : sfml-macosx-x86_64.tar.bz2 (1.4 Mo).

Thank you :)
Ceylo

24
General discussions / Mac OS X port to be continued
« on: July 24, 2009, 01:58:31 pm »
Hello,

As you may know, I'm taking care of the Mac OS X implementation of SFML. I've been working on it for about one year and a half at this time. When I started this work, the previous developper had left the implementation incomplete. Since then I've switched the implementation from the Carbon API to the Cocoa API, in order to provide SFML integration in Cocoa based applications and ensure SFML's perenniality. I've learnt very much : I already knew Cocoa and Objective-C, but I had never really practiced C++.

However I now want to get rid of SFML development in order to work on other projects. Working 18 months on the same few files is a pain. I don't plan to develop SFML 2. I'll stay in order to fix the existings bugs in SFML 1 in order to ensure there is at least one SFML stable version for Mac OS X. Thus my work will stop when Laurent stops developping this branch.

Therefore the SFML project needs another Mac OS X developer ! Here is what you'll need if you wish to do this work : Objective-C and C++ languages, Cocoa API and OpenGL (you'll not need to know the OpenGL API but at least how OpenGL works with the OS).

Obviously, I stay here to answer to your questions, especially to the developpers that may wish to contribute. I can explain to these persons how all my "mess" works, and I'll always be able to do so even when someone else will have taken my place (so be confident, I won't let you alone in the jungle that is my work ;) ).

Ceylo


P.S.: English is not my native language, so you may find some expressions unconvenient or devalorizing even if it was not my purpose.

25
Audio / [Mac OS X] Needing tester
« on: March 29, 2009, 03:28:52 pm »
Hello,

As you may know, there are some troubles with the OpenAL framework provided on Mac OS X 10.4 (see this topic).

I finally found what looks to be an up-to-date source of the Mac OS X OpenAL implementation. I've made a sample to try it out and it does work for me (Mac OS X 10.5 on an Intel Mac). I need to know whether it does also work fine on Mac OS X 10.4.

Here is the project including all the needed frameworks and a precompiled application. It'll read the "music.ogg" sound file and play for 3 seconds before terminating.

audio-sample.tar.bz2

Thanks,
Ceylo

Pages: 1 [2]
anything