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

Author Topic: SFML with no window  (Read 3480 times)

0 Members and 1 Guest are viewing this topic.

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
SFML with no window
« 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)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML with no window
« Reply #1 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?
Laurent Gomila - SFML developer

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: SFML with no window
« Reply #2 on: December 19, 2012, 08:25:51 am »
This is not the easiest way
« Last Edit: December 19, 2012, 08:41:55 am by Acrobat »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML with no window
« Reply #3 on: December 19, 2012, 08:36:27 am »
May I ask why?
Laurent Gomila - SFML developer

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: SFML with no window
« Reply #4 on: December 19, 2012, 08:42:13 am »
i don't know anything about this mac windowing api/GC

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML with no window
« Reply #5 on: December 19, 2012, 08:50:49 am »
But what is the problem?
Laurent Gomila - SFML developer

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: SFML with no window
« Reply #6 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 ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML with no window
« Reply #7 on: December 19, 2012, 10:19:23 am »
I have no idea about how the OS X part of SFML works, sorry.
Laurent Gomila - SFML developer

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: SFML with no window
« Reply #8 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

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: SFML with no window
« Reply #9 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 ?
« Last Edit: December 19, 2012, 11:39:48 am by Acrobat »

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: SFML with no window
« Reply #10 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

 

anything