Sign up

How to compile the SimpleGL sample?

I am new to D on linux and I have compiled and run the TestWindow sample. I thought the next step might be to work with the SimpleGL example:

demos/gl/simple/SimpleGL.d

But I have been unable to compile it. This is where I am up to.

[~/d/GtkD-3.6.5/demos/gl/simple]$ dmd SimpleGL.d -L-L~d/GtkD-3.6.5/ -L-lgtkd-3
SimpleGL.d(21): Error: module Event is in file 'gdk/Event.d' which cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import

I know an Event object is in the libgtkd-3 library...

[~/d/GtkD-3.6.5]$ ar -t libgtkd-3.a | grep "Event"
EventSequence.o
Event.o
EventController.o
EventBox.o

Could someone add a makefile or let me know how to compile and link this SimpleGL.d file?

Re: How to compile the SimpleGL sample?

On 20-07-17 16:04, Alan Turvey wrote:

I am new to D on linux and I have compiled and run the TestWindow sample. I thought the next step might be to work with the SimpleGL example:

demos/gl/simple/SimpleGL.d

But I have been unable to compile it. This is where I am up to.

[~/d/GtkD-3.6.5/demos/gl/simple]$ dmd SimpleGL.d -L-L~d/GtkD-3.6.5/ -L-lgtkd-3
SimpleGL.d(21): Error: module Event is in file 'gdk/Event.d' which cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import

I know an Event object is in the libgtkd-3 library...

[~/d/GtkD-3.6.5]$ ar -t libgtkd-3.a | grep "Event"
EventSequence.o
Event.o
EventController.o
EventBox.o

Could someone add a makefile or let me know how to compile and link this SimpleGL.d file?

You are missing the path the the GtkD source files and the opengl library.

dmd SimpleGL.d -I~d/GtkD-3.6.5/generated/gtkd -L-L~d/GtkD-3.6.5/ 
-L-lgtkd-3 -L-lGL -L-ldl

And if you used make install or installed GtkD with the package
manager of your distribution (if available), you could use pkg-config.

dmd `pkg-config --cflags --libs gtkd-3` -L-lGL

Re: How to compile the SimpleGL sample?

Thank you. I added another library and I am getting closer. Now I am seeing this, at which I can't even guess...

[~/d/GtkD-3.6.5/demos/gl/simple] $ dmd SimpleGL.d -I~/d/GtkD-3.6.5/generated/gtkd -I~/d/GtkD-3.6.5/generated/gtkdgl -L-L~/d/GtkD-3.6.5/ -L-lglgdk-3 -L-lGL -L-ldl 
/home/alan/d/GtkD-3.6.5/generated/gtkdgl/glgtk/GLCapability.d(93): Error: variable simpleGL.SimpleGL.SimpleGL.GLCapability!().drawFrame.cr default construction is disabled for type Scoped
/home/alan/d/GtkD-3.6.5/generated/gtkdgl/glgtk/GLCapability.d(94): Error: struct std.typecons.scoped!(Context).Scoped is not copyable because it is annotated with @disable

On Thu, 20 Jul 2017 19:18:15 +0200, Mike Wey wrote:

On 20-07-17 16:04, Alan Turvey wrote:

I am new to D on linux and I have compiled and run the TestWindow sample. I thought the next step might be to work with the SimpleGL example:

demos/gl/simple/SimpleGL.d

But I have been unable to compile it. This is where I am up to.

[~/d/GtkD-3.6.5/demos/gl/simple]$ dmd SimpleGL.d -L-L~d/GtkD-3.6.5/ -L-lgtkd-3
SimpleGL.d(21): Error: module Event is in file 'gdk/Event.d' which cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import

I know an Event object is in the libgtkd-3 library...

[~/d/GtkD-3.6.5]$ ar -t libgtkd-3.a | grep "Event"
EventSequence.o
Event.o
EventController.o
EventBox.o

Could someone add a makefile or let me know how to compile and link this SimpleGL.d file?

You are missing the path the the GtkD source files and the opengl library.

dmd SimpleGL.d -I~d/GtkD-3.6.5/generated/gtkd -L-L~d/GtkD-3.6.5/ 
-L-lgtkd-3 -L-lGL -L-ldl

And if you used make install or installed GtkD with the package
manager of your distribution (if available), you could use pkg-config.

dmd `pkg-config --cflags --libs gtkd-3` -L-lGL

Re: How to compile the SimpleGL sample?

On 21-07-17 01:36, Alan Turvey wrote:

Thank you. I added another library and I am getting closer. Now I am seeing this, at which I can't even guess...

[~/d/GtkD-3.6.5/demos/gl/simple] $ dmd SimpleGL.d -I~/d/GtkD-3.6.5/generated/gtkd -I~/d/GtkD-3.6.5/generated/gtkdgl -L-L~/d/GtkD-3.6.5/ -L-lglgdk-3 -L-lGL -L-ldl
/home/alan/d/GtkD-3.6.5/generated/gtkdgl/glgtk/GLCapability.d(93): Error: variable simpleGL.SimpleGL.SimpleGL.GLCapability!().drawFrame.cr default construction is disabled for type Scoped
/home/alan/d/GtkD-3.6.5/generated/gtkdgl/glgtk/GLCapability.d(94): Error: struct std.typecons.scoped!(Context).Scoped is not copyable because it is annotated with @disable

Fixed in git:
https://github.com/gtkd-developers/GtkD/commit/39145d5159ff0100c720c83ae35f5abc7fafab78

The Simple demo uses the gtkglext3 binding, gtkglext3 is currently
unmaintained and binaries are usually not available in the package
repositories.

If you are using the demos as a starting point, you are better of using
the gl/core demo. That use gtk.GLArea witch is actually part of gtk.