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

Author Topic: Crash when using RenderTexture  (Read 2086 times)

0 Members and 1 Guest are viewing this topic.

Robert42

  • Newbie
  • *
  • Posts: 31
    • View Profile
Crash when using RenderTexture
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Crash when using RenderTexture
« Reply #1 on: September 18, 2012, 08:16:30 pm »
Laurent Gomila - SFML developer

Robert42

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Crash when using RenderTexture
« Reply #2 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.