Skip to content

Rendertextures still broken on old Intel graphics chips #418

@mattreecebentley

Description

@mattreecebentley

I'd read that the rendertexture problems with intel graphics chipsets had been solved, they probably have been for newer chipsets.
I checked the following code (see after this statement) with an Asus 1000HA, older intel chipset (works fine for everything else in SFML) and it glitched out on rendertextures. Compiled with latest stable mingw GCC and SFML2, works fine on every other (non intel graphics) machine I've tried it on. The Asus has had no problem with games I've played on it.

/* 
 * File:   main.cpp
 * Author: paulo radtke
 *
 * Created on 2 de Abril de 2013, 00:15
 * http://chienloco.com/blog
 */

#include <cstdlib>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

using namespace std;

int main(int argc, char** argv) {
    // Create the main window with an arbitrary resolution
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
    window.setMouseCursorVisible(false);
    window.setFramerateLimit(60);
    window.setVerticalSyncEnabled(true);

     // Load a sprite to display and create its texture
    sf::Texture textBackground;
    if (!textBackground.loadFromFile("resources/sfml_logo.png"))
        return EXIT_FAILURE;
    sf::Sprite background(textBackground);  

    // Creates the off screen rendering target with the fixed resolution
    sf::RenderTexture offscreen;
    if(!offscreen.create(1280,720,false))
        return EXIT_FAILURE;

    // We set this texture for smoothing, so it looks good when scaling
    offscreen.setSmooth(true);

    // The offset to draw the texture and creates the scrolling illusion
    int offset=0;   

    // Start the game loop
    while (window.isOpen())
     {
        sf::Event event;

        while (window.pollEvent(event)) {
            // Close window : exit
            if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                window.close();
        }

        offscreen.clear();

        // Calculates the offset for the x and y axis and draws the sprites
        int offx = (640.0 * offset)/640.0;
        int offy = (360.0 * offset)/640.0;

        for(int line = 0;line < 3 ; line++)
            for(int column = 0 ; column < 3 ; column++){
                background.setPosition((float)(column*640 - offx), (float)(line*360 - offy));
                offscreen.draw(background);
            }         

                // Flushes the off screen rendering target
        offscreen.display();

        if(++offset >= 640)
            offset=0;

        // Update the window
        window.clear();
        sf::Sprite temp(offscreen.getTexture());

        // Calculates the scale according to the video resolution and the position
        temp.scale(800/1280.0, 450/720.0);
        temp.setPosition(0, 75);
        window.draw(temp);
        window.display();        
    }    
    return EXIT_SUCCESS;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions