hi,
there is a little example of code. (I use gtkglext)
but how to connect the root group with the drawing area??
thanks.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
gboolean init(GtkWidget widget, gpointer data){
GdkGLContext * context = gtk_widget_get_gl_context(GTK_WIDGET(drawing_area));
GdkGLDrawable * surface = gtk_widget_get_gl_drawable(GTK_WIDGET(drawing_area));
/* activation du contexte */
if(gdk_gl_drawable_gl_begin(surface,context))
{
/* dessin OpenGL */
gdk_gl_drawable_swap_buffers(surface); /* permutation des tampons */
gdk_gl_drawable_gl_end(surface); /* désactivation du contexte */
}
return TRUE;
}
int main (int argc, char **argv)
{
osg::Group* root = new osg::Group();
osg::Geode* pyramidGeode = createPyramid();
root->addChild(pyramidGeode);
GladeXML *xml;
gtk_init(&argc, &argv);
glade_init();
xml = glade_xml_new("../ConfigFile/WindowsView.glade", "window1", NULL);
if (!xml) {
g_warning("problem while loading the .glade file");
return 1;
}
GtkWidget *window1 = glade_xml_get_widget (xml, "window1");
drawing_area = glade_xml_get_widget(xml, "drawingarea1");
g_signal_connect(G_OBJECT(drawing_area),"realize",
G_CALLBACK(init),NULL);
GdkGLConfig * config;
config = gdk_gl_config_new_by_mode (static_cast<GdkGLConfigMode>
(GDK_GL_MODE_RGB |
GDK_GL_MODE_DEPTH |
GDK_GL_MODE_DOUBLE) );
GdkGLContext * context;
context = gtk_widget_get_gl_context(GTK_WIDGET(drawing_area));
gtk_widget_set_gl_capability(GTK_WIDGET(drawing_area), config,
context, TRUE, GDK_GL_RGBA_TYPE);
gtk_widget_show (window1);
gtk_main();
return 0;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
On 12/22/06, elekis <[EMAIL PROTECTED]> wrote:
On 12/21/06, Jeremy L. Moles <[EMAIL PROTECTED]> wrote:
> On Thu, 2006-12-21 at 16:49 -0500, Jeremy L. Moles wrote:
> > On Thu, 2006-12-21 at 21:46 +0000, Robert Osfield wrote:
> > > Hi,
> > >
> > > The easist way to do it is first have a look at the
> > > osgViewer::SimpleViewer and osgsimple, osgkeyboadmouse and
> > > osgsimpleview* examples in CVS. None of the these are gtk based but
> > > it really shouldn't be hard to link it up once you see how the OSG can
> > > be wired up to other toolkits.
> >
sorry , but, not of them have gtk window ?? I don't understand all
could you be more precisely. THe only thing I try to do is connect a
pyramid osg in a gtkdrawingarea (constructed with glade)
> > You'll probably need to connect the GLScene object to an event called
> > "display" in a user-defined callback (at least that's how it works in
> > Python). This gets called once per frame, so it's where you'll use your
> > SceneView object to communicate with the current, implicit context.
>
> Actually, my summation is off here a bit--I assumed that 1) you were
> using GtkGlExt and 2) the Python API was 1:1 w/ the C library.
> Apparently, in gtkglext, you "give" a widget GL capability (such as a
> DrawingArea).
>
> Ignore it for now and I'll work up a real example later...
>
> > If I make an example doing this, would it go in OSG? osgsimpleviewerGTK
> > or whatever?
> >
> > > Robert.
> > >
> > > On 12/21/06, elekis <[EMAIL PROTECTED]> wrote:
> > > > hi all,
> > > >
> > > > I have to do some simulations in c++, and for the first time, I have
> > > > to use the gtk and osg.
> > > > I have to use osg in a gtk window(drawingarea I suppose) and the
> > > > inteface is creating with libglade.
> > > >
> > > > but I have lots of difficult.
> > > > is there any tutorial example or anything other stuff who can help
> > > > me to connect this three library ..???
> > > >
> > > > for example. there is my glade file.
> > > >
> > > >
--------------------------------------------------------------------------------------------------------------
> > > > <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> > > > <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
> > > > <!--Generated with glade3 3.0.2 on Thu Dec 21 18:41:06 2006 by [EMAIL
PROTECTED]>
> > > > <glade-interface>
> > > > <widget class="GtkWindow" id="window1">
> > > > <child>
> > > > <widget class="GtkDrawingArea" id="drawingarea1">
> > > > <property name="visible">True</property>
> > > > </widget>
> > > > </child>
> > > > </widget>
> > > > </glade-interface>
> > > >
----------------------------------------------------------------------------------------------------------------
> > > >
> > > > like you see it's just a simple window with a drawingarea.
> > > >
> > > > and there is my c++ file.
> > > >
--------------------------------------------------------------------------------------------------------------
> > > > #include <gtk/gtk.h>
> > > > #include <glade/glade.h>
> > > >
> > > > int main (int argc, char **argv)
> > > > {
> > > > GladeXML *xml;
> > > > gtk_init(&argc, &argv);
> > > >
> > > > glade_init();
> > > > xml = glade_xml_new("../ConfigFile/WindowsView.glade", "window1",
NULL);
> > > >
> > > > if (!xml) {
> > > > g_warning("problem while loading the .glade file");
> > > > return 1;
> > > > }
> > > > GtkWidget *window1 = glade_xml_get_widget (xml, "window1");
> > > > gtk_widget_show (window1);
> > > > gtk_main();
> > > >
> > > > return 0;
> > > > }
> > > >
------------------------------------------------------------------------------------------------------------------------
> > > >
> > > > like you see too, it's not so complicate but How to connect the osg
> > > > with the drawing area.
> > > > is a drawing area I have to use (that's what I read, but how to use
> > > > gtkmm with it??)
> > > >
> > > > thanks a lot.
> > > > _______________________________________________
> > > > osg-users mailing list
> > > > [email protected]
> > > > http://openscenegraph.net/mailman/listinfo/osg-users
> > > > http://www.openscenegraph.org/
> > > >
> > > _______________________________________________
> > > osg-users mailing list
> > > [email protected]
> > > http://openscenegraph.net/mailman/listinfo/osg-users
> > > http://www.openscenegraph.org/
> > >
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> > http://openscenegraph.net/mailman/listinfo/osg-users
> > http://www.openscenegraph.org/
> >
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/