Jump to content
  • Advertisement
Sign in to follow this  
Dennis Majvall

SFML RenderTexture slow performance?

This topic is 1933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I just started with the C++ library: SFML and while making my game-loop I noticed something disturbing.

 

Relevant part of the Header:

public:
    virtual const sf::Texture Draw();
protected:
    sf::RenderTexture sb;

 

When I try to call the "Draw" method I use this code:

currentRenderScreen->Draw();

 

Which do this:

const sf::Texture RenderScreen::Draw() {
    return sb.getTexture();
}

 

The reason I use a RenderTexture is because I want to draw multiple sprites and images on a texture, and then display the texture as it's whole (I think it's called backbuffer?). And I need to return a "Texture" to be able to draw it in my window.

However it's extremely slow if my "RenderTexture sb" is normally big (800 width 600 height), around 200 milliseconds per call (110 on my friend's computer), if the object sb is 100 px wide and 100 high or smaller it only takes a handful milliseconds to call.

 

I'm pretty sure I'm doing something wrong as using a RenderTexture should be the optimal way to draw stuff in a game?

If it really is this heavy to use, is there any better alternative?

Share this post


Link to post
Share on other sites
Advertisement

This topic is 1933 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!