Loic wrote:
> Thanks a lot Greg, it was obviously the base Draw Method that were missing.
> I am still not very used to FLTK, but I really like it's design.

        Right -- and you don't really need your own draw() method
        unless you're drawing custom stuff. Otherwise just leave
        the definition of draw() out, and the default will occur.

> Is better to call the base draw before my own code, or the opposite?

        Depends on if you want to draw over the widget and its children,
        or under them.

        I would think you'd want to call the base draw() first,
        so you can draw over it. Drawing 'under' only works if
        the widget is transparent in places (ie. FL_NO_BOX).

> Other things...
> I was actually definning the main class (FROG_Displayer) to be
> a FL_Gl_Window, because I need to load all the openGl Texture
> in that class,

        You can't put FLTK widgets into an Fl_Gl_Window,
        so don't go that route.

> But I know (from a previous thread on this forum), that the OpenGl
> Texture Loading has to be done in the draw method encapsulated in 
> if(!valid()){....;valid(1);}

        Yes, exactly.

> But this do not work with the standard FL_Window...
> What should I do in order to allow Gl Loading in this method?

        Why does the display class have to load the texture?
        Why can't the GL widget load it? Look what I do here
        in this simple openGL texture example:
        http://seriss.com/people/erco/fltk/#OpenGLTextureMap

        ..note the GlInit() function loads the texture map, which is called
        from the GL widget's draw() method during the 'if ( !valid() )'
        test for the GL widget.

        Your display class can keep track of the filename,
        but when it comes to actually loading the texture,
        let the GL window handle it on initialization.

> 
> void FROG_Displayer::draw()
> {
>    if(!valid()){
>       Fl::gl_visual(FL_RGB);
>       LoadTexture((unsigned int*)&LogoTexture     
> ,FROG_PATH::GetGlobalPath("Resources/Frog_Logo.png"   
> ,AbsolutePath.c_str()).c_str());
>       valid(1);
>    }
>    Fl_Window::draw();
> }

        In this case, you probably want a variable to keep track
        of when the texture is loaded, so that it only loads once.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to