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

Author Topic: sf::RenderTexture problems.  (Read 8098 times)

0 Members and 1 Guest are viewing this topic.

bobingabout

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: sf::RenderTexture problems.
« Reply #15 on: March 12, 2014, 11:25:36 am »
I have 4 computers in my office here, so I tried my program (both the test program, and what I thought should work for my actual progam). They all have Intel graphics, 2 of them with similar cards to my own (A 915G, and a 865G) didn't work, but the newer ones (i3 based) did work, for both programs.

I'm thinking I should keep this code, and write another version using pixel manipulation on an image (not as clean, and processor heavy by comparison) for those older incompatable cards.


My question though is, is there a way to check with SFML if a card is capable of using a RenderTexture or not, or would I need to set that myself with my config file, and give the user the option?
« Last Edit: March 12, 2014, 11:34:30 am by bobingabout »

bobingabout

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: sf::RenderTexture problems.
« Reply #16 on: March 12, 2014, 11:56:45 am »
Okay... this is crazy, I managed to solve the problem:

Instead of saving a reference to the texture from RenderTexture.getTexture() and passing that to Sprite.setTexture(), or simply passing the returned value from getTexture() stright to setTexture(), as was in my example, I instead copied the texture from getTexture() as so, it worked!

// in class headder
sf::Texture texttexture;
sf::Sprite textsprite;

// in function
sf::RenderTexture rendertexture;
// after doing things on rendertexture
texttexture = rendertexture.getTexture();
textsprite.setTexture(texttexture);
 

so I'm not sure WHY it doesn't like you passing it the value from getTexture() on certain graphics cards directly, or a reference to it, but it works if you copy it!

Anyway, problem solved.
« Last Edit: March 12, 2014, 01:06:19 pm by bobingabout »

bobingabout

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: sf::RenderTexture problems.
« Reply #17 on: March 14, 2014, 01:17:54 am »
I suppose a problem with copying the texture from the RenderTexture.getTexture to a Texture... it's copying the texture, on slower cards, it's SLOW.

I hadn't noticed initially, because it was only doing the opteration on startup, but my procedure locks up the rendering by a whole second while it creates 12 sprites less than 100x100 in size.

 

anything