SFML community forums

Help => Graphics => Topic started by: Acrobat on December 18, 2012, 08:47:41 pm

Title: SFML with no window
Post by: Acrobat on December 18, 2012, 08:47:41 pm
I wonder, is it possible to initialize ogl with sdl or else (without sf::Context), and use drawing with sfml ?
I need it to finish the screensaver for OSX (problems with Garbage Collection and window package)
Title: Re: SFML with no window
Post by: Laurent on December 18, 2012, 10:44:51 pm
Nope, you can only draw SFML entities on a sf::RenderTarget.

Wouldn't it be simpler for you to modify SFML so that it is compatible with your requirements?
Title: Re: SFML with no window
Post by: Acrobat on December 19, 2012, 08:25:51 am
This is not the easiest way
Title: Re: SFML with no window
Post by: Laurent on December 19, 2012, 08:36:27 am
May I ask why?
Title: Re: SFML with no window
Post by: Acrobat on December 19, 2012, 08:42:13 am
i don't know anything about this mac windowing api/GC
Title: Re: SFML with no window
Post by: Laurent on December 19, 2012, 08:50:49 am
But what is the problem?
Title: Re: SFML with no window
Post by: Acrobat on December 19, 2012, 09:31:53 am
Ok, i will try.
I launched the minimum sfml program under profiller (GC logging), successfully crashed in 10 sec.
Quote
    sf::RenderWindow window(sf::VideoMode(1024, 768), "");
    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
                window.close();
        }
        window.clear();
        window.display();
    }


I'm thinking about deleting inner autorelease pool, what do you think about it ?
Title: Re: SFML with no window
Post by: Laurent on December 19, 2012, 10:19:23 am
I have no idea about how the OS X part of SFML works, sorry.
Title: Re: SFML with no window
Post by: Acrobat on December 19, 2012, 10:34:46 am
Removing inner pool did not helped.
Quote
I have no idea about how the OS X part of SFML works, sorry.
same as me
Title: Re: SFML with no window
Post by: Acrobat on December 19, 2012, 11:31:22 am
now the problem is clear - GC destroys NSOpenGLContext
is there a way to force GC not to collect garbage ?
Title: Re: SFML with no window
Post by: Acrobat on December 19, 2012, 12:00:12 pm
changing
m_context = [[NSOpenGLContext alloc] initWithFormat:pixFmt shareContext:sharedContext];
 
to
m_context = [[[NSOpenGLContext alloc] initWithFormat:pixFmt shareContext:sharedContext] retain];
 
does not helped