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

Author Topic: Native Handle of sf::RenderTexture  (Read 1772 times)

0 Members and 1 Guest are viewing this topic.

Mazzelfassel

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Native Handle of sf::RenderTexture
« on: March 16, 2017, 03:46:54 am »
I've currently integrated the ImGui Libary into my SFML eviroment and started to draw my own custom Widgets. So far so good it works fine with normal sf::Textures using the getNativeHandle() function but when I Try to get the Handle of a RenderTexture my Widget just contains white Boxes (like when the sf::Texture got lost).
So my question is, is there any difference between accessing the OpenGL handle of a RenderTexture and the Handle of a regular sf::Texture?

Working example wit sf::Texture
draw_list->AddImage((void*)(texture.getNativeHandle()), rect.Min, rect.Max);
Only white boxes when using sf::RenderTexture
draw_list->AddImage((void*)(getRenderTexture().getNativeHandle()), rect.Min, rect.Max);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Native Handle of sf::RenderTexture
« Reply #1 on: March 16, 2017, 06:37:15 am »
What's the return type of getRenderTexture?
Laurent Gomila - SFML developer

Mazzelfassel

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Native Handle of sf::RenderTexture
« Reply #2 on: March 16, 2017, 08:21:50 pm »
const sf::Texture& getRenderTexture() { return(renderTexture.getTexture()); }
Trying to save the Texture of the sf::RenderTexture in a seperate class member results in a nativeHandle of 0

Mazzelfassel

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Native Handle of sf::RenderTexture
« Reply #3 on: March 16, 2017, 08:55:05 pm »
Nevermind I've found the bug.  :o You cant display a RenderTexture if its never drawn, another victim of to early runtime optimisations (there was a flag that skipped the draw Function of the RenderTexture when no logical changes occured).