[Osggtk-users] Overlaying a button on top of the OSGGtk window
Status: Beta
Brought to you by:
rvinyard
From: Larson, T. <TL...@Hu...> - 2010-07-29 17:50:12
|
I have been using the OsgGTK library with great success... But, I'd like the ability to place a button on top of the OSG GTK 3D window. I would like my button to appear on top of the the 3D scene. As an experiment, I wrote the following snippet of code. Both the button and the OSG GTK are created and are functional. BUT... The OSG GTK window appears on top of the button, even though the button is created after the Graphics Window. I would like the button to overlay the OSG GTK window. Any suggestions would be greatly appreciated. // Create an OSG gtk window osgViewer::GraphicsWindowGtk* gw = viewer->setup_viewer_in_gtk_window(width,height); // Create a fixed container to contain both the OSG GTK window and a button GtkWidget *TopFixedContainer; TopFixedContainer = gtk_fixed_new(); gtk_box_pack_start(GTK_BOX(main_vbox), TopFixedContainer, TRUE, TRUE, 0); gtk_widget_show( TopFixedContainer ); // Show a OSG gtk window gtk_fixed_put (GTK_FIXED (TopFixedContainer), gw->gtk_widget(), 70, 65); gtk_widget_show(gw->gtk_widget()); // Show a demo button GtkWidget *button; button = gtk_button_new_with_label ("Lookat f"); gtk_fixed_put (GTK_FIXED (TopFixedContainer), button, 50, 50); gtk_widget_show (button); In this sample code I intentionally place the OSG gtk window so that the corner overlays the button. I do this so that I can tell which widget is on top. In the final program, I'd like to put the OSG gtk window at (0,0) and put the button at (50,50) so that the button is on top of the OSG gtk window. - Tim Larson - |