-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation for RenderTexture incomplete #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Why is there ImGui here O_o |
This comment has been minimized.
This comment has been minimized.
Code is this, and it does indeed reproduce. Only for the interaction with ImGui though. require "crsfml"
require "imgui"
require "imgui-sfml"
window = SF::RenderWindow.new(SF::VideoMode.new(1280, 720), "ImGui + SFML = <3")
window.framerate_limit = 60
ImGui::SFML.init(window)
delta_clock = SF::Clock.new
while window.open?
while (event = window.poll_event)
ImGui::SFML.process_event(event)
if event.is_a? SF::Event::Closed
window.close
end
end
ImGui::SFML.update(window, delta_clock.restart)
frame = SF::Image.from_file("some.jpg")
texture = SF::RenderTexture.new(frame.size.x, frame.size.y)
texture.clear
texture.draw(SF::Sprite.new(SF::Texture.from_image(frame)))
texture.display()
sprite = SF::Sprite.new(texture.texture)
ImGui.image_button(sprite)
window.clear
window.draw sprite
ImGui::SFML.render(window)
window.display
end
ImGui::SFML.shutdown |
But the issue is with "imgui-sfml" (not even its Crystal binding). If you were getting this effect without ImGui, then it'd be about not having called Either way, this is not about CrSFML. Also I almost never add my own examples to https://oprypin.github.io/crsfml/api/, everything there is directly ported from SFML's own docs. |
SFML/imgui-sfml#35 (comment) - it seems like they never ended up adding those overloads like they planned. |
No, I'm not finding an appropriate way to implement this as part of imgui-sfml. They really just need to add that overload, then I'll do the same. |
I also saw those comments/promises about the overloads years ago; but obviously they didn't come. Nevertheless users have an issue with those RenderTextures. So I was searching for a workaround and the easiest I could find was the |
Hello, I'm sorry about the delay - the problem was pretty complex and I kinda procrastinated, yep. If you check out "render-texture-fixes" branch and it'll work for you, then I'll merge it into master soon. |
Yes, that branch works well, thank you! Then the example above just needs to be changed |
I can also confirm - thank you! |
The fix merged into master, here: SFML/imgui-sfml@ee41e16 |
SFML seems to have a problem with
RenderTexture
s in combination withSprite
s. Typically, the sprites will get drawn upside down.This also took me a while, but finally I came across https://stackoverflow.com/questions/22424124/sfml-rendertexture-flipped-output, which helped me solve the problem easily.
Maybe you want to update your code example accordingly in https://oprypin.github.io/crsfml/api/SF/RenderTexture.html.
The text was updated successfully, but these errors were encountered: