Here is the whole code:
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
sf::Texture t_grass;
if(!t_grass.loadFromFile("M_03.png"))
cout<<"ERROR: can't load file"<<endl;
sf::Sprite s_grass(t_grass);
s_grass.setPosition(0,0);
// Prepare the ground
sf::RenderTexture rt_ground;
if(!rt_ground.create(500, 500))
cout<<"ERROR: can't create render texture"<<endl;
rt_ground.clear(sf::Color::White);
rt_ground.draw(s_grass);
rt_ground.display();
sf::Sprite s_ground(rt_ground.getTexture());
sf::Event event;
// Start the game loop
while (window.isOpen())
{
// Process events
while (window.pollEvent(event))
{
// Close window : exit
if(event.type == sf::Event::Closed)
window.close();
}
// Clear screen
window.clear();
window.draw(s_ground);
// Update the window
window.display();
}
return EXIT_SUCCESS;
}
And here is the result:
As you can see, it is very weird. It renders the source code upside down and distorted but it's the source code. It's not always the source code, I simply got lucky once and the dirstortions were easy to compare to the stuff on the screen.
I am probably doing something very wrong. What is it?
notes:
- The M_03.png is a 10x10px png.
- There is no console output at all.
Setup:
Archlinux
NVIDIA GeForce 7600GS
Nouveau open source driver
Thanks
EDIT: Just for completeness sake, this is how it should have looked like (it works using the nvidia blob):