GtkGLArea with GtkOffscreenWindow

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GtkGLArea with GtkOffscreenWindow

Rob Conde

Hello,

   Consider the following program:


int main()
{
gtk_init(nullptr,nullptr);

auto window = gtk_offscreen_window_new();
auto gl_area = gtk_gl_area_new();

gtk_container_add(GTK_CONTAINER(window),gl_area);

gtk_widget_realize(gl_area);

gtk_widget_show_all(window);

auto glContext = gtk_gl_area_get_context(GTK_GL_AREA(gl_area));

std::cout << "Context is " << glContext << std::endl;

gtk_main();
}
  

The glContext is null. Can GtkGLArea work with GtkOffscreenWindow?


Thanks,

Rob Conde


_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: GtkGLArea with GtkOffscreenWindow

Rob Conde

Replying to myself:


Talked to Emmanuele on IRC...the gist is:


  • no, this won't work
  • GtkOffscreenWindow shouldn't be used in general
  • The desired effect can be achieved by using a GtkWindow, not showing it, and explicitly mapping the widget

Rob




From: gtk-list <[hidden email]> on behalf of Rob Conde <[hidden email]>
Sent: Thursday, October 4, 2018 8:17:59 AM
To: [hidden email]
Subject: GtkGLArea with GtkOffscreenWindow
 

Hello,

   Consider the following program:


int main()
{
gtk_init(nullptr,nullptr);

auto window = gtk_offscreen_window_new();
auto gl_area = gtk_gl_area_new();

gtk_container_add(GTK_CONTAINER(window),gl_area);

gtk_widget_realize(gl_area);

gtk_widget_show_all(window);

auto glContext = gtk_gl_area_get_context(GTK_GL_AREA(gl_area));

std::cout << "Context is " << glContext << std::endl;

gtk_main();
}
  

The glContext is null. Can GtkGLArea work with GtkOffscreenWindow?


Thanks,

Rob Conde


_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list