SFML community forums

Help => General => Topic started by: Pfeffer on May 31, 2013, 12:18:07 am

Title: Empty window after porting from SFML 1.6 to 2.0 [Solved]
Post by: Pfeffer on May 31, 2013, 12:18:07 am
Hello guys,

I have a big problem after updating a big project to SFML 2.0 from 1.6. The program seems to run fine (no errors) and the window is shown, but it is always empty (transparent, i see what was before the window appeared). I can move the mouse cursor, but that's it. The program worked fine before updaing to 2.0. I needed to compile SFML 2.0 by myself, since I had to update my mingw-gcc compiler for this update (precompiled libs didn't work with mingw-gcc 4.7.2).

While porting I already paid attention to this list of differences between 1.6 and 2.0:
http://en.sfml-dev.org/forums/index.php?topic=5343.0

Facts until now (will be updated):

Code of the handleEvents function:
void
InteractionHandler::handleEvents() {
    sf::Event Event;
    while (windowInstance->pollEvent(Event)) {
        switch (Event.type) {
        case sf::Event::Closed:
            appContext->App->close();
            exit(0);
            break;
        case sf::Event::GainedFocus:
            appContext->hasFocus = true;
            break;
        case sf::Event::LostFocus:
            appContext->hasFocus = false;
            break;
            break;
        case sf::Event::MouseMoved:
            onMouseMovement(Event.mouseMove.x, Event.mouseMove.y);
            break;
        }
    }
}


Project Description:
The project is a little game which only uses 2 dynamic libs of SFML: libsfml-system and libsfml-window. It uses OpenGL (3.3) using also GLEW 1.6.0 (1.9.0 didn't work). I've put the glew include into the SFML OpenGL header (SFML/Window/OpenGL.cpp), before the GL headers and after the windows.h. My program is structured like the OpenGL example, but a little more complex:
http://www.sfml-dev.org/tutorials/2.0/window-opengl.php
I only use one window and only one thread. Expect for GLEW  my only other library I use is FreeImage to load some textures. Rendering is done via Shaders (Vertex, Geometry and Fragment Shaders), also using VBOs and VAOs for the vertex data. Input is only done with keyboard and mouse.

Compilation of SFML 2.0:
I used the CMake-GUI tool. Selected the directory of the extracted SFML 2.0 sources, configured the project (BUILD_SHARED_LIBS = TRUE, CMAKE_BUILD_TYPE = Release) and then generated the Makefile. I targeted a Makefile project with the MinGW-GCC compiler (default compiler). Then I opened a console and used mingw32-make to compile SFML 2.0 with the generated Makefile. I followed this instructions without knowing: http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php

Hard- & Software:
I am using Windows 7 Prof. 64bit on a 5 year old notebook hardware:
Intel 2 Duo P8600 - 2.4Ghz
Nvidia Geforce 9600M GT
4GB RAM

Situation before updating:
Project used SFML 1.6. Program used OpenGL 3.3 with GLEW. No OpenGL errors were printed and the game ran fine.

I've already paid attention to the "Read before posting"-thread (http://en.sfml-dev.org/forums/index.php?topic=5559.0) and cleaned and recompiled the project several times.

I will try to post a very reduced version of my program, if no one has a clue.

Thanks for your help.
Title: Re: Empty window after porting from SFML 1.6 to 2.0 [Solved]
Post by: Pfeffer on May 31, 2013, 01:05:25 am
So the problem really was the update to SFML 2.0: A buggy pollEvents function which always returns a MouseMoved event, when no other events are available.

But it is not completly solved, since I can't change the pollEvents() function. I will create a bug report on this.

Update: Nailed it (https://github.com/SFML/SFML/issues/399).