On 10/03/2016 11:46 PM, Chalix wrote:
On Monday, 3 October 2016 at 18:00:53 UTC, Mike Wey wrote:
The signal functions can be found in the gobject.Signals module.

But you should use the GLArea.addOnCreateContext / addOnRender /
addOnResize functions to attach a D delegate to the signal.
You will still need to link with the OpenGL libraries or use someting
like Derelict.

Hi Mike, thanks for your fast answer again!

I just read about this delegates and I liked the concept. I experimented
with it for a while and read a bit on the Internet, but I still don't
get it working...

My minimal example looks like this:

import gtk.Main;
import gtk.MainWindow;
import gtk.GLArea;
import glgdk.GLContext;

void main(string[] args)
{
    bool render(GLContext context, GLArea area)
    {
        return true;
    }

    Main.init(args);
    MainWindow win = new MainWindow("Hello World");
    GLArea area = new GLArea();

    area.addOnRender(&render,cast(GConnectFlags)0);

    win.add(area);
    win.showAll();
    Main.run();
}

If I compile it, I get this error:

$ dmd main.d -I/usr/local/include/d/gtkd-3 -L-lgtkd-3
main.d(27):
Error: function gtk.GLArea.GLArea.addOnRender
(bool delegate(GLContext, GLArea) dlg, GConnectFlags connectFlags =
cast(GConnectFlags)0)
is not callable using argument types
(bool delegate(GLContext context, GLArea area), GConnectFlags)

I cant see, what I am doing wrong... Someone else sees the error?
Tomorrow I try to subclass the GLArea, if this works I am happy :) But
I'd like to use the handler stuff.

Ah, and I know now, that I have to link against the GL and GLU library,
but which module do I have to import, to make the functions visible for
the compiler? Or do I need another binding therefore?

Replace "import glgdk.GLContext;" with "import gdk.GLContext;"

The error is a bit confusing without the fully qualified names of the types, but GLArea depends on the OpenGL functionality build in to GDK, and doesn't depend on gtkglext.

--
Mike Wey

Reply via email to