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

Author Topic: Issues with sf::rendertexture  (Read 2142 times)

0 Members and 1 Guest are viewing this topic.

Joshu145

  • Newbie
  • *
  • Posts: 10
    • View Profile
Issues with sf::rendertexture
« on: October 19, 2015, 09:40:39 pm »
Hey guys i've been having some issues getting a rendertexture to work correctly. Well it might not be the render texture itself but my code surrounding it. here's the stack overflow link to my question i would greatly appreciate any help.

http://stackoverflow.com/questions/33219674/sfml-rendertexture-not-returning-texture/33220439?noredirect=1#comment54246560_33220439

G.

  • Hero Member
  • *****
  • Posts: 1592
    • View Profile
Re: Issues with sf::rendertexture
« Reply #1 on: October 19, 2015, 10:06:40 pm »
drawingtexture is destroyed at the end of Tile_Map::RenderChunk

Joshu145

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Issues with sf::rendertexture
« Reply #2 on: October 19, 2015, 10:10:02 pm »
I attempt to make a copy inside a map of textures. at least i thought i did, is it possible that it's only passing by reference?


Joshu145

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Issues with sf::rendertexture
« Reply #4 on: October 19, 2015, 10:18:14 pm »
How would i go about copying it into the map then?

Joshu145

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Issues with sf::rendertexture
« Reply #5 on: October 19, 2015, 10:25:06 pm »
If you could link me to an article that explains it that would be great as well. I would love the opportunity to learn more about the explanation than just a simple answer =P

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Issues with sf::rendertexture
« Reply #6 on: October 19, 2015, 10:53:01 pm »
I would love the opportunity to learn more about the explanation than just a simple answer =P
And we'd love to have a clear question, to avoid pointless guessing. If people still don't know what you mean after 6 posts, it's a good indicator that you should state your question differently ;)

Please read this post, and please do so carefully. It takes some time, but it will help you get better help in the future. And it certainly takes less time than waiting so long for answers :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Joshu145

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Issues with sf::rendertexture
« Reply #7 on: October 19, 2015, 11:23:04 pm »
Sorry for not clarifying well enough. I'm just not sure how to go about getting a copy of a texture that i've made within a rendertexture. not just a reference to the rendertexture

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10838
    • View Profile
    • development blog
    • Email
Issues with sf::rendertexture
« Reply #8 on: October 19, 2015, 11:50:56 pm »
sf::Texture tex = rt.getTexture();

Keep in mind that copying textures is slow.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Joshu145

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Issues with sf::rendertexture
« Reply #9 on: October 20, 2015, 12:02:58 am »
I tried doing that. so it must be that i'm trying to copy a blank rendertexture because when i try and draw it to a window it doesn't even create a blank square. 

G.

  • Hero Member
  • *****
  • Posts: 1592
    • View Profile
Re: Issues with sf::rendertexture
« Reply #10 on: October 20, 2015, 12:34:17 am »
I think I was wrong, I'm really sorry. :(
But I think the size of the rectangle shapes you are drawing is 0, 0.
« Last Edit: October 20, 2015, 12:38:36 am by G. »

 

anything