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

Author Topic: Sprite stretches with window  (Read 1666 times)

0 Members and 1 Guest are viewing this topic.

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Sprite stretches with window
« on: October 19, 2015, 04:25:28 pm »
I got SFML Working and I loaded a sprite into it and it stretches with my window, i'm not sure why, the tutorial section didnt really say anything about it. I tried a few things on there that might have worked but still nothing.

Also in the console i get this message:
"OpenGL extension SGIS_texture_edge_clamp unavailable
Artifacts may occur along texture edges
Ensure that hardware acceleration is enabled if available"

Im not sure if that has anything to do with it or not, but the last time i used SFML i never got that message in console so maybe it does but I don't know what it means, or what the program needs.


#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!");

    sf::Texture RedSquareTexture;
    if(!RedSquareTexture.loadFromFile("Red_Square.png")) //32x32 red square
    {
        std::cout << "Error" << std::endl;
    }

    sf::Sprite RedSquareSprite;
    RedSquareSprite.setTexture(RedSquareTexture);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear(sf::Color::White);
        window.draw(RedSquareSprite);
        window.display();
    }

    return 0;
}
 


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Sprite stretches with window
« Reply #1 on: October 19, 2015, 04:28:03 pm »
Also in the console i get this message:
"OpenGL extension SGIS_texture_edge_clamp unavailable
Artifacts may occur along texture edges
Ensure that hardware acceleration is enabled if available"
This basically means that you're not using the latest SFML version. ;)
It's a bug and it has been fixed.

I got SFML Working and I loaded a sprite into it and it stretches with my window, i'm not sure why, the tutorial section didnt really say anything about it. I tried a few things on there that might have worked but still nothing.
This is standard behavior. If you want it differently you'll need to adjust the view. See the dedicated tutorial for that.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Sprite stretches with window
« Reply #2 on: October 19, 2015, 05:31:18 pm »
"This basically means that you're not using the latest SFML version. ;)
It's a bug and it has been fixed."

Oh, I downloaded the latest version from that website in your signature, I tried building SFML before and that took me like 3 days, and even then I didnt figure it out, I just found that site and used one from there. I'll have a look at views.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Sprite stretches with window
« Reply #3 on: October 19, 2015, 06:06:44 pm »
My "nighlty" builds are currently behind the official builds, so use the official builds.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Sprite stretches with window
« Reply #4 on: October 19, 2015, 06:39:54 pm »
I'll have a look at views.
Start with the official view tutorial and then maybe, also check out the info on views on the wiki. And, of course, there's also the view API documentation.