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

Author Topic: [MAC OS X] SFML2 & Failed to activate the window's conte  (Read 2914 times)

0 Members and 1 Guest are viewing this topic.

AdrianM

  • Newbie
  • *
  • Posts: 43
    • View Profile
[MAC OS X] SFML2 & Failed to activate the window's conte
« on: November 30, 2010, 10:50:22 pm »
I'm trying to figure out what's happening here. I just get a white window with this code(the output should be black). Also looking at the console i see that every frame a message is sent: "Failed to activate the window's context." I'm on an INTEL card here(old i know), so what could be wrong?

Code: [Select]

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

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML OpenGL");

    // Start game loop
    while (window.IsOpened())
    {
        // Process events
        sf::Event event;
        while (window.GetEvent(event))
        {
            // Close window : exit
            if (event.Type == sf::Event::Closed)
                window.Close();

            // Escape key : exit
            if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape))
                window.Close();
        }
        // Clear the depth buffer & color buffer
        glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

        // Finally, display the rendered frame on screen
        window.Display();
    }

    return EXIT_SUCCESS;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
[MAC OS X] SFML2 & Failed to activate the window's conte
« Reply #1 on: November 30, 2010, 11:02:12 pm »
Are you able to run other OpenGL applications on your computer?
Laurent Gomila - SFML developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
[MAC OS X] SFML2 & Failed to activate the window's conte
« Reply #2 on: November 30, 2010, 11:18:07 pm »
The reason is much simpler. From SFContext.mm line 87 :
Code: [Select]
bool SFContext::MakeCurrent()
{
    [myContext makeCurrentContext];
}

Hiura forgot the return call. He should be notified about this little mistake :P .
Want to play movies in your SFML application? Check out sfeMovie!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
[MAC OS X] SFML2 & Failed to activate the window's conte
« Reply #3 on: December 01, 2010, 12:01:43 am »
Is it better now ?

@ Ceylo : thanks a lot !  :)
SFML / OS X developer

AdrianM

  • Newbie
  • *
  • Posts: 43
    • View Profile
[MAC OS X] SFML2 & Failed to activate the window's conte
« Reply #4 on: December 01, 2010, 12:30:27 am »
Thanks guys! It works now!

 

anything