Hi Hannes,

can't see anything obvious.... Can you try to switch on
debugging mode? And you are sure you got the ogl context?

To switch on the OpenSG debugging messages:

#include <OpenSG/OSGLog.h>

OSG::osgLog().setLogLevel(OSG::LOG_DEBUG);
OSG::osgLog().setLogFile( "osglog.txt" );

and see if the output gives you any clue...

Regards,

  Toni

> >Antonio Bleile wrote:
> >>
> >>
> >> after the ogl context has been made current by gtk
> >> you have to call "init()" on the passive window.
> >
> >In addition to that the PassiveWindow also needs to be informed about
> >
> >Window resizes, that's an easy one to forget, but 0x0 pixel images
> >are
> >not that useful. ;)
> 
> i've tried this, too.
> i attached my source code. it may be a bad style, but it is only a test
> application ;-) maybe you find the missing line.
> 
> ----- snip ------
> #include "main.h"
> 
> 
> #include <gtkmm/main.h>
> #include <gtkmm/window.h>
> #include <gtkmm/label.h>
> #include <gtkmm/drawingarea.h>
> #include <gdk/gdkgl.h>
> #include <gtk/gtkgl.h>
> #include <iostream>
> #include <OpenSG/OSGPassiveWindow.h>
> #include <OpenSG/OSGSimpleGeometry.h>
> #include <OpenSG/OSGSimpleSceneManager.h>
> #include <OpenSG/OSGDrawAction.h>
> 
> 
> OSG::SimpleSceneManager* mgr;
> OSG::PassiveWindowPtr pwin;
> 
> 
> int main(int argc, char* argv[]){
>  osg::osgInit(argc,argv);
>  Gtk::Main kit(argc, argv);
>  initOpenGLSubsys(&argc, &argv);
>  Gtk::Window window;
>  Gtk::DrawingArea drawArea;
>  drawArea.set_size_request(600,600);
> 
>  std::cout << "Enabling GL Window..";
>  GdkGLConfig *glConfigMode =
>  gdk_gl_config_new_by_mode((GdkGLConfigMode)(GDK_GL_MODE_RGB |
>  GDK_GL_MODE_DOUBLE | GDK_GL_MODE_DEPTH));
> 
> gtk_widget_set_gl_capability((GtkWidget*)drawArea.gobj(),glConfigMode,NULL
> ,true,GDK_GL_RGBA_TYPE);
> 
>  gboolean isGLCap = gtk_widget_is_gl_capable((GtkWidget*)drawArea.gobj());
>  if(isGLCap)
>   std::cout << "OK..\n";
>  else
>   std::cout << "Error..\n";
> 
>  window.set_title("Test");
>  window.add(drawArea);
>  drawArea.show();
>  drawArea.add_events((Gdk::EventMask)GDK_VISIBILITY_NOTIFY_MASK);
> 
> 
>  g_signal_connect_after (G_OBJECT ((GtkWidget*)drawArea.gobj()),
> "realize",
>                           G_CALLBACK (init), NULL);
> 
>  g_signal_connect (G_OBJECT ((GtkWidget*)drawArea.gobj()), "expose_event",
>       G_CALLBACK (draw), NULL);
> 
>  Gtk::Main::run(window);
> }
> 
> static gboolean
> draw (GtkWidget      *widget,
>       GdkEventExpose *event,
>       gpointer        data)
> {
>   GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
>   GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
> 
>  gdk_gl_drawable_gl_begin (gldrawable, glcontext);
>   mgr->redraw();
>  gdk_gl_drawable_gl_end (gldrawable);
> 
>  return true;
> }
> 
> void init(GtkWidget *widget,
>      gpointer   data){
> 
>  GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
>   GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
> 
>   gdk_gl_drawable_gl_begin (gldrawable, glcontext);
> 
>  pwin = OSG::PassiveWindow::create();
> 
>  pwin->init();
>  pwin->resize(600,600);
> 
>  OSG::NodePtr scene = OSG::makeTorus(.5, 2, 16, 16);
> 
>   // create the SimpleSceneManager helper
>   mgr = new OSG::SimpleSceneManager;
> 
>   // tell the manager what to manage
>   mgr->setWindow(pwin );
>   mgr->setRoot  (scene);
> 
>   // show the whole scene
>   mgr->showAll();
> 
>  gdk_gl_drawable_gl_end (gldrawable);
> }
> 
> void initOpenGLSubsys(int* argc, char*** argv){
>  gtk_gl_init(argc, argv);
>  gdk_gl_init(argc, argv);
>  std::cout << "Checking for OpenGL..";
>  gboolean hasOpenGL = gdk_gl_query_extension();
>  if(hasOpenGL)
>   std::cout << "OK\n";
>  else
>   std::cout << "NOT FOUND!!!\n";
> }
> ---- snap ----
> 
> Hannes
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to