gtkd-developers / GtkD

GtkD is a D binding and OO wrapper of GTK+ originally created by Antonio Monteiro
http://gtkd.org
Other
322 stars 71 forks source link

Add OpenGL core profile demo #132

Closed Ace17 closed 9 years ago

Ace17 commented 9 years ago

Here's a GtkD with "modern" OpenGL standalone demo. It's a D-simplified translation of the C++ example in gtkmm (seems like the 'simple' OpenGL demo using glBegin/glEnd is obsolete). I had to add a glcore.d import file. Maybe this file would fit better in gtkcgl ?

MikeWey commented 9 years ago

For me the demo only compiles and links when i remove the export from the function definitions in glcore.d

Ace17 commented 9 years ago

Here's how I compiled it:

$ gdc CoreGL.d `pkg-config gtkd-3 gl --cflags --libs` -o demo.exe && ./demo.exe  
Ace17 commented 9 years ago

Indeed, I got link errors with rdmd:

$ rdmd `pkg-config gtkd-3 --cflags` -L-lGL -L-ldl CoreGL.d
/tmp/.rdmd-1000/rdmd-CoreGL.d-34137C8B6C6C2BA1758446FBCEC175AF/objs/CoreGL.o: In function `_D6coreGL6CoreGL6CoreGL9unrealizeMFC3gtk6Widget6WidgetZv':
/usr/local/include/d/gtkd-3/gdkpixbuf/Pixbuf.d:(.text._D6coreGL6CoreGL6CoreGL9unrealizeMFC3gtk6Widget6WidgetZv+0x69): undefined reference to `_imp__glDeleteBuffers'
/usr/local/include/d/gtkd-3/gdkpixbuf/Pixbuf.d:(.text._D6coreGL6CoreGL6CoreGL9unrealizeMFC3gtk6Widget6WidgetZv+0x7a): undefined reference to `_imp__glDeleteProgram'
/tmp/.rdmd-1000/rdmd-CoreGL.d-34137C8B6C6C2BA1758446FBCEC175AF/objs/CoreGL.o: In function `_D6coreGL6CoreGL6CoreGL6renderMFC3gdk9GLContext9GLContextC3gtk6GLArea6GLAreaZb'
MikeWey commented 9 years ago

DMD issue https://issues.dlang.org/show_bug.cgi?id=922.

Ace17 commented 9 years ago

OK, I removed the 'export' keywords. Now you can run the demo like this:

$ rdmd `pkg-config gtkd-3 --cflags` -L-lGL -L-ldl CoreGL.d