-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Run three-d in GTK-GL #292
Comments
It should definitely be possible, it's exactly the same thing as Also, this is a duplicate of #27 |
@Siliwolf Did you make it work? 🙂 |
No, I didn't mean to mark as completed. I just came to the issues page for an unrelated reason, saw my duplicate was still up, and decided to close it. |
Hello! I've gotten the triangle example to work in a GLArea, more or less, after looking at the things you linked. I can't make it work using
This is a paraphrase of what's in the glium example. I assume that
This isn't meant to be good (I don't need to be re-making the model every time), it's just meant to work, which it does. I would like to avoid using the 2 unsafe lines, but the commented-out |
Super nice work 💪 that would be great to have as an example 🥳 About the render target, GTK probably uses a custom render target instead of the default one, and since it's created in GTK, three-d doesn't know about it. If you can somehow get the FrameBuffer ID from GTK, you can use this function to create the render target instead of the |
Thanks! Sadly GDK's GLContext docs say "A GdkGLContext is not tied to any particular normal framebuffer". Probably there is some way but the GDK & GTK docs don't make it obvious. Besides manually calling If it doesn't bother you that this is slightly hacky, I can turn it into a clean(er) example and make a pull for it. |
Hmm. Yeah, it seems like GTK doesn't expose that information 😬 The problem is not that it uses the core unsafe functions for clearing the render target, the problem is that it's not possible to use a render target, which for example means deferred rendering will not work. If we used a render target, then there's no way to know which frame buffer to switch back to when we want to draw to the screen. We could maybe use the attach_buffers method but it requires that we call it at the right time, which isn't obvious how to do. I actually think getting the frame buffer index manually using
That would be great 👍 As I see it, the only thing that needs to be fixed is the render target issue ☝️ and maybe figuring out how to create models outside of the render loop. |
I'm opening this issue in favour of #27 |
I have something working with a RenderTarget and with the model initialised outside the render loop. I've used glGetIntegerv once before rendering starts to get the draw fb, which seems to work fine. It relies on GTK not randomly deciding to use a different fb, and although I've never seen that happen on my setup, I don't know enough about GTK/GDK/GSK rendering to say it can't 😢 |
Sorry for the late reply.
Great, then I think that's a good solution.
True, so maybe it's better to call
I'm sorry, I can't help with that, but I think it's ok to add the example even though it's confirmed to work on all platforms. Having an example is much better than not having anything 🙂 |
In
GTK
, there is aGLArea
widget (https://docs.gtk.org/gtk4/class.GLArea.html). Is it possible to integratethree-d
in there? I see it's possible withinegui
, but I don't know if that crosses over. Thanks for anything!The text was updated successfully, but these errors were encountered: