Hi,

On Mon, 2009-12-07 at 13:34 +0100, Daniel Weber wrote:
> Hi all, 
> 
> I try to combine some OpenGL functionality with OpenSG. After some time, I 
> found out that glGetError didn't return "no_error". 
> A slight modification of the sample 01hello.cpp (in Examples/Simple) 
> [SNIP]
> int main(int argc, char **argv)
> {
>     // OSG init
>     OSG::osgInit(argc,argv);
>       
>     // GLUT init
>     int winid = setupGLUT(&argc, argv);
>       
>     // open a new scope, because the pointers gwin and scene below should
>     // go out of scope before entering glutMainLoop.
>     // Otherwise OpenSG will complain about objects being alive after 
> shutdown.
>     {
>         // the connection between GLUT and OpenSG
>         OSG::GLUTWindowRefPtr gwin = OSG::GLUTWindow::create();
>         gwin->setGlutId(winid);
>               GLenum err;
>               err= glGetError();
>               std::cout << gluErrorString(err) << std::endl;
>               gwin->init();
>               err = glGetError();
>               std::cout << gluErrorString(err) << std::endl;
>               
>               
>         // create the scene
>         OSG::NodeRefPtr scene = OSG::makeTorus(.5, 2, 16, 16);
>     
>         OSG::commitChanges();
> [SNAP]
> leads to the output:
> 
> no error
> invalid operation
> 
> I started debugging GLUTWindow, but I got lost. Anyone an idea?
> 

yes, the context is not active anymore after gwin->init(); 
Hence you call glGetError without a context. If you want to
have the context bound for the app you must explicitly call
gwin->activate() after gwin->init()

kind regards,
  gerrit




------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to