Closed lattice0 closed 1 year ago
you can use from_glib_none
from your side as well?
Sorry I did not understand the question. i used it, it didn't crash, it crashed on epoxy as far as I understood.
-------- Mensagem Original -------- Em 23 de jul. de 2022 19:01, Bilal Elmoussaoui escreveu:
you can use from_glib_none from your side as well?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
I fixed the epoxy crash, now no crashes (but also no image), but I need to know if it's ok to do
pub fn new_from_ptr(gl_context: *mut ffi::GdkGLContext) -> Self {
unsafe {
from_glib_none(gl_context)
}
}
on the PR
You don't need a new function, just call from_glib_none() yourself.
For initialization there's the unsafe gtk::set_initialized() that you'd need here if you assume something else called gtk_init() for you already.
unsafe { gtk::set_initialized() };
println!("gtk::is_initialized: {}", gtk::is_initialized());
let context = unsafe { gdk::GLContext::from_glib_none(gdk_gl_context_ptr) };
println!("version: {:?}", context.version());
println!("is_legacy: {:?}", context.is_legacy());
gives
(my_app:13317): Gdk-CRITICAL **: 21:46:24.482: gdk_gl_context_get_version: assertion 'priv->realized' failed
(my_app:13317): Gdk-CRITICAL **: 21:46:24.482: gdk_gl_context_is_legacy: assertion 'priv->realized' failed
and prints
gtk::is_initialized: true
version: (0, 33742432)
I even tried putting gtk::init()
before but same problem.
As the error suggests, your problem is that the context is not realized yet and because of that can't be used.
I have a C++ Flutter code which generates me a
GdkGLContext
:where the pointers are C pointers.
On https://github.com/gtk-rs/gtk3-rs/blob/master/gdk/src/auto/gl_context.rs I added
so I could initialize it from a raw C
GdkGlContext
, but I get a panic onassert_initialized_main_thread!
, probably because the gtk3-rs has an internal watcher to see if the main thread is initialized, and I'm trying to initialize an object without having a context.Can I do a PR without the assertion?
works but I can't be sure yet cause I get a
function was not loaded
panic probably on epoxy (cause I don't know how to do OpenGL on gtk3-rs)