> Christian Convey wrote:
> > I'm porting to OS X 10.5 an app that works just fine on Linux.  I'm using 
> > FLTK 1.1.7.
> >
> > We have a class (MarineViewer) that subclasses from Fl_Gl_Window.  In 
> > MarineViewer's constructor, we have this code:
> >
> >    m_textures = new GLuint[1];
> >    ...
> >    glGenTextures(1, m_textures);
> >
> > The call to glGenTextures is generating a bus error.  I think it's related 
> > to something I found while debugging:  If I call "this->context()" from 
> > within that same constructor, I get back the value NULL.  I assume this 
> > means that for some reason, FLTK isn't able to get an OpenGL context for my 
> > program to use.
> >
> > Any idea why I might be seeing this?  Any idea how I can fix it?
>
>       If the code you're running needs a valid gl context, try moving
>       this code to the !valid() section of your draw() method, eg:
>
> void MarineViewer::draw() {
>     if ( ! valid() ) {
>       ..
>       glGenTextures(1, m_textures);
>       ..
>     }
> }
>
>       By that time FLTK will have created the actual window and context.
>
>       I'm thinking FLTK doesn't actually create the GL window/context
>       until after the constructors have been called, and the program
>       has started the FLTK event loop.

That did it!  Thanks!

For some reason Linux has no problem with the way the app was coded previously, 
but OS X did.

_______________________________________________
fltk-opengl mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-opengl

Reply via email to