|
Post by rikky on May 31, 2020 11:51:41 GMT 1
Problem solved indeed.
|
|
|
Post by vovchik on May 31, 2020 18:48:02 GMT 1
Dear all, Here is a partially working port of an old HUG svg demo I did years ago. I am now porting it to the new GUI proxy, and have run into a little problem in that I don't quite know how to stop the animation. A keypress or Pause button click should do it (as in the HUG version), but I am still missing some gtk/gdk thread handler or idle function. Any suggestions? I know we are all experimenting now, but Peter probably knows the best method in this circumstance. With kind regards, vovchik
|
|
|
Post by Pjot on Jun 1, 2020 6:56:54 GMT 1
Hi vovchik, Thanks for this port. The problem you are facing is the issue of async updates outside the main eventloop. As mentioned before, you can use the ALARM statement for this. I took the liberty of modifying your program, it is attached to this post. Hope this is what you are looking for? Note that we do not need to update GTK in between, so I removed that part. Best regards Peter PS yesterday I investigated the GtkGLArea, we can use it but unfortunately the GTK developers have decided to go for the new 'core API' of OpenGL 3.2 and higher. So that means we need to define a vertex buffer, a vertex array, then a vertex shader and fragment shader in OpenGL Shader Language, and lastly, dump the whole thing using using glDrawArray, and all this is needed even when we only need to draw a simple line. Or even draw a simple pixel. IMHO it's a ridiculous decision from the GTK developers, especially because now also they have excluded low-end systems which do not have access to OpenGL 3.x. Apparently, they think we all are going to implement a high-end 3D engine or something like that...
|
|
|
Post by vovchik on Jun 1, 2020 11:38:35 GMT 1
Dear Peter, Thanks a million! Because of my slow hardware, I set the ALARM msec to 100 - it prevents stalling and reduces the CPU load. Now working nicely, and I know how to do it for ports of earlier HUG versions I will do and post shortly. I have attached gtk2 and gtk3 versions. I set the msec higher for gtk3 since, otherwise I get stalling - it seems gtk3 is more CPU intensive. With kind regards, vovchik
|
|
|
Post by Pjot on Jun 1, 2020 12:19:49 GMT 1
Hi vovchik, Well, instead of ALARM, you can also use g_timeout_add and g_source_remove. This, however, adds another global variable in your program, but the program does not stall. Even so, when putting the value in g_timeout_add to a low value, then there may be no animation. But 20msecs works for me without stalling. BR Peter
|
|
|
Post by vovchik on Jun 1, 2020 12:35:35 GMT 1
Dear Peter,
I am getting this error - and no binary on Mint:
In file included from hypnosis-grad-inline-gtk2-vov.bac:247:0, from hypnosis-grad-inline-gtk2-vov.bac.c:2: hypnosis-grad-inline-gtk2-vov.bac: In function ‘ANIM_START’: hypnosis-grad-inline-gtk2-vov.bac:137:41: warning: passing argument 2 of ‘g_timeout_add’ makes pointer from integer without a cast [-Wint-conversion] Timeout_Status = g_timeout_add(20, G_SOURCE_FUNC(UPDATE), NULL) ^~~~~~~~~~~~~ In file included from /usr/include/glib-2.0/glib/giochannel.h:33:0, from /usr/include/glib-2.0/glib.h:54, from /usr/include/glib-2.0/gobject/gbinding.h:28, from /usr/include/glib-2.0/glib-object.h:23, from /usr/include/glib-2.0/gio/gioenums.h:28, from /usr/include/glib-2.0/gio/giotypes.h:28, from /usr/include/glib-2.0/gio/gio.h:26, from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30, from /usr/include/gtk-2.0/gdk/gdk.h:32, from /usr/include/gtk-2.0/gtk/gtk.h:32, from hypnosis-grad-inline-gtk2-vov.bac:15, from hypnosis-grad-inline-gtk2-vov.bac.c:2: /usr/include/glib-2.0/glib/gmain.h:605:10: note: expected ‘GSourceFunc {aka int (*)(void *)}’ but argument is of type ‘int’ guint g_timeout_add (guint interval, ^~~~~~~~~~~~~ hypnosis-grad-inline-gtk2-vov.bac.o: In function `ANIM_START': hypnosis-grad-inline-gtk2-vov.bac.c:(.text.ANIM_START+0x6e): undefined reference to `G_SOURCE_FUNC' collect2: error: ld returned 1 exit status make: *** [hypnosis-grad-inline-gtk2-vov] Error 1
I wonder why G_SOURCE_FUNC is undefined...any idea?
With kind regards, vovchik
|
|
|
Post by Pjot on Jun 1, 2020 13:22:11 GMT 1
Dear vovchik, No idea really... we're using plain C code now, and talking directly to GTK - and I am not a GTK guru Maybe you can leave the G_SOURCE_FUNC out, or use a different cast in front of the function name, like (GSourceFunc)UPDATE or (GSourceFunc*)UPDATE. HTH Peter
|
|
|
Post by vovchik on Jun 1, 2020 13:54:00 GMT 1
Dear Peter, Thanks. (GSourceFunc)UPDATE did the trick. WIth kind regards, vovchik
|
|
|
Post by vovchik on Jun 1, 2020 15:28:06 GMT 1
Dear all, Here is another demo (gtk2/3) of a rotating cube. Seems to be working nicely. WIth kind regards, vovchik
|
|
|
Post by Pjot on Jun 1, 2020 17:29:41 GMT 1
Thanks vovchik,
Very cool - works on my Mageia Linux without problems!
BR Peter
|
|
|
Post by bigbass on Jun 1, 2020 19:32:25 GMT 1
hello vovchik
very impressive! great to see your demo doing 3D with svg's ! that's a real break though
P.S
there were many things we did in gtk2 and gtk3 a few years ago that can be updated and improved on and some new ideas after looking back with a little more experience the reason I say this is because many GUI's in linux use gtk and the more ways we can see it are the more options we have to choose from
Joe
|
|
|
Post by vovchik on Jun 1, 2020 21:59:43 GMT 1
Dear Joe, Thanks. We are starting to get the hang of this. There are many demos to port, with various widgets, and a lot of DEFs and ALIASes to test. I think we will learn something. I used your gtk3 ALIASes when I was porting. With kind regards, vovchik
|
|
|
Post by alexfish on Jun 1, 2020 22:41:47 GMT 1
Hi Peter
lastest beta Gtk Radio program Raspberry pi3 , got some problems
/home/pi/retestVG/mybuild/examples/tlse-master/examples/radiopr.bac:161:19: error: 'gtk_menu_popup_at_pointer' undeclared (first use in this function)
also getting xaw errors:
/usr/include/X11/Xaw3d/AllWidgets.h:34:8: error: unknown type name 'XmuWidgetNode'
have not tried motif
BR Alex
|
|
|
Post by vovchik on Jun 1, 2020 23:04:36 GMT 1
Dear Alex, You have to install all the bits and then use a PRAGMA flag. I have attached my pi versions...and they compile and work. With kind regards, vovchik Attachments:radio-pi.tar.gz (7.65 KB)
|
|
|
Post by alexfish on Jun 1, 2020 23:40:40 GMT 1
Hi Vovchik Now get gtk collect2: error: ld returned 1 exit status xaw gui shows but get Warning: Missing charset in String to FontSet conversion When closing xaw :: desktop menu and icons have Escaped :: need to Switch OFF PI , oh dear Back Soon :: BR Alex
|
|