SFML community forums

Help => Graphics => Topic started by: Robert42 on September 18, 2012, 07:48:10 pm

Title: Crash when using RenderTexture
Post by: Robert42 on September 18, 2012, 07:48:10 pm
I could only reproduce it on my Linux Mint 13 64bit Laptop with onboard Intel graphic (Mobile Intel GM45 Express Chipset).

It's working without problems on my PC with NVidia Graphic-Card (also Linux Mint 13 64bit)

Here's the minimal Code to reproduce:

#include <SFML/Graphics.hpp>
 #include <SFML/OpenGL.hpp>
 
 int main()
 {
     // Create the main window
     sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
     sf::RenderWindow* RENDER_WINDOW = &window;
 
 
     // Start the game loop
     while (window.isOpen())
     {
         // Process events
         sf::Event event;
         while (window.pollEvent(event))
         {
             // Close window : exit
             if (event.type == sf::Event::Closed)
                 window.close();
                 
             if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Space)
             {            
              sf::RenderTexture render_texture;

              render_texture.create(800, 600);
              render_texture.setActive(true);

              render_texture.pushGLStates();
              render_texture.resetGLStates();
              glClearColor(0.f, 0.f, 0.f, 0.f);
              glClearDepth(1.f);

              glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

              render_texture.popGLStates();

              RENDER_WINDOW->setActive(true);
             }
         }
 
         // Clear screen
         window.clear();
 
         // Update the window
         window.display();
     }
 
     return EXIT_SUCCESS;
 }

Edit: it crashes when executing the  RENDER_WINDOW->setActive(true); line.
Title: Re: Crash when using RenderTexture
Post by: Laurent on September 18, 2012, 08:16:30 pm
You didn't search before posting... ;D

https://github.com/SFML/SFML/issues/101
http://en.sfml-dev.org/forums/index.php?topic=9149.0
Title: Re: Crash when using RenderTexture
Post by: Robert42 on September 18, 2012, 08:25:00 pm
Actually I've searched.
But not good enough (note by Captain Obvious  ;) )

Thx for posting the links.