View: 7430|Reply: 9

3D easy to use libs/frameworks lcogl, clutter, mx for mali-400

[Copy link]

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
Published in 2016-5-13 18:12:28 | Show all floors |Read mode
Edited by bhgv at 2016-5-18 15:49

they all built on lubuntu 15.04 jaser-2, loboris kernel and work well.

cogl:
https://github.com/bhgv/cogl-orange-pi-2-h3

clutter:
https://github.com/bhgv/clutter-orange-pi-2-h3

mx-1 :
https://github.com/bhgv/mx--clut ... ork--orange-pi-2-h3

cogl - is a library of 3D hardware accelerated graphics built on top of ogl, ogles and others (https://www.cogl3d.org/). it gives more simple and uniform api to work with 3d. has many bindings. in python for example.

clutter - is a library on the top of cogl to build different sprite animations, animated 3D cool interfaces and other. (https://wiki.gnome.org/Projects/Clutter) also has binding to different languages. python as examle (http://www.modrana.org/pyclutter ... ial/html/index.html)

mx - is a ready to use gui framework built on top of clutter and cogl. it provides easy way to build cool animated 3d user interfaces. it also has bindings (yes, in the python: http://clutter-and-mx-under-pyth ... ntroduction.html#mx)

11

threads

286

posts

1936

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
1936
Published in 2016-5-23 01:08:25 | Show all floors
Thank you for this,is awesome!!!

18

threads

303

posts

9909

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9909
Published in 2016-5-26 20:52:48 | Show all floors
@bhgv Well done. Keep up the good work.

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-5-26 21:25:03 | Show all floors
@melanrz @jacer, thank you for your feedbacks. i've build also cluttersmith, a tool for compose clutter interfaces (like glade), but i thought noone interested this. it is on beta stage, but maybe someone will interest in it

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-5-28 07:17:06 | Show all floors
Edited by bhgv at 2016-5-28 07:20

how to make frame by frame animation. example:
```python
from gi.repository import Clutter

Clutter.init(None)

stage = Clutter.Stage()
# ^^ import lib, initialise, create a stage to draw

rect = Clutter.Rectangle()

rect.set_size(200, 300)
rect.set_position(250, 300)

red = Clutter.Color.get_static(Clutter.StaticColor.RED)
rect.set_color(red)

stage.add_actor(rect)
# ^^ create shape/object, set its size and position, set its color and add it to stage. looks as flash as3, yes?

### VV animation itself
rotation_angle = 0
color_change_count = 0
cc_d = 1
ax_m = 0
axs = [Clutter.RotateAxis.X_AXIS, Clutter.RotateAxis.Y_AXIS, Clutter.RotateAxis.Z_AXIS]
# ^^ just variables for animation

# callback for redrawing of frame. it is called on each frame
def on_timeline_new_frame(timeline, frame_num, rect):  # format: foo(timeline, frame_num, parameter)
    global rotation_angle, ax_m, axs
    rotation_angle += 1
    if rotation_angle >= 360:
        rotation_angle = 0

#    print frame_num
    rect.set_rotation_angle(axs[ax_m], rotation_angle)  # set new angle of rotation and from time to time new axis of rotation

    # Change the color and alpha
    global color_change_count, cc_d
    color_change_count += cc_d
    if color_change_count >= 255 or color_change_count <= 0:
        cc_d = -cc_d
    if color_change_count == 0:
        ax_m += 1
        if ax_m >= 3:
            ax_m = 0

    rect_color = Clutter.Color().new(255, 0, 0, color_change_count)  # here changed only alpha
    rect.set_color(rect_color)  # and set new color to animated object


tl = Clutter.Timeline()  # create timeline for animation
tl.set_duration( 4000 )  # length of timeline

#tl.add_marker_at_time("keyframe_1", 2000) # milliseconds # < it is keyframe for keyframed animation. not used here

tl.connect('new-frame', on_timeline_new_frame, rect)  # connect callback for frame by frame animation

#tl.connect('marker-reached', on_timeline_marker_reached)  # < callback for keyframed animation. not used here

tl.set_loop(True)  # set looping mode of this timeline
tl.start()  # start animation
### AA animation itself


### VV quit this program callback
def clutter_quit(*args):
    Clutter.main_quit()

# quit when the window gets closed
stage.connect('destroy', clutter_quit)
### AA quit this program callback


# --VV show stage & main loop
stage.show()
Clutter.main()
```

easy as flash as for me. + it works with 3d.

// hmm, where is colorisation of code? how to enable it?

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-6-5 20:27:07 | Show all floors
clutter-gtk - (mix of clutter and gtk widgets)
---------------------------------------------------------

https://github.com/bhgv/clutter- ... pi-2-lubuntu-tested

it is 0.12 version. it is need for cluttersmith - a clutterscript (json) visual composer. in few time i hope to upload higher build

it will be good if someone who experimented with cogl/clutter/clutter-gtk or/and their bindings share some codes/experienses. theese are the fastest 3d gui libs for gles and will be good to have more cool interfaces except horrible tk ones.

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-6-5 20:31:50 | Show all floors
if someone have not seen yet - example how to connect callbacks/signals from json/clutter script description to python code.

https://github.com/bhgv/clutter- ... from-Clutter.Script

```python
def clutter_quit(*a):  # your callback
    Clutter.main_quit()


def _extract_handler_and_args(obj_or_map, handler_name):
    handler = None

    if handler_name == "clutter_main_quit": # test for signal name from your clutter script
        handler = clutter_quit              # and select corresponding callback
    args = ()
    return handler, args

def _builder_connect_callback(builder, gobj, signal_name, handler_name, connect_obj, flags, obj_or_map):
    handler, args = _extract_handler_and_args(obj_or_map, handler_name)

    after = flags & GObject.ConnectFlags.AFTER
    if connect_obj is not None:
        if after:
            gobj.connect_object_after(signal_name, handler, connect_obj, *args)
        else:
            gobj.connect_object(signal_name, handler, connect_obj, *args)
    else:
        if after:
            gobj.connect_after(signal_name, handler, *args)
        else:
            gobj.connect(signal_name, handler, *args)

def connect_signals(self, obj_or_map):
    self.connect_signals_full(_builder_connect_callback, obj_or_map)


# ... your code
script = Clutter.Script()
script.load_from_file( "ui.json")
stage = script.get_object("stage")
connect_signals( script, stage )
# ... your code
```

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-6-5 20:33:11 | Show all floors
see to Clutter-GTK 2 posts upper

11

threads

286

posts

1936

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
1936
Published in 2016-6-6 02:43:24 | Show all floors
thank you for this,it help me a lot to make my home automation gui !!!!!

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-6-7 22:58:18 | Show all floors
Edited by bhgv at 2016-6-8 00:24
melanrz replied at 2016-6-6 02:43
thank you for this,it help me a lot to make my home automation gui !!!!!

it looks as interesting project.

i wanted to make home/small shop/other automation system some time ago.

i planned to build it using inferno-os, a opensource crossplatform multithread framework disigned to build net-targeted decentralised systems (a example: http://thread.gmane.org/gmane.os.inferno.general/3782/focus=3789 , russian a little widther translation - https://www.ibm.com/developerworks/ru/library/l-inferno_plan9_2/ ).
http://www.vitanuova.com/inferno/
https://www.ueber.net/who/mjl/inferno/getting-started.html
it has very powerful and easy to use possibility to work with devices, network, inter-programs/computers channels, easy to use possibility to create distributed network with security, possibility to install/remove nodes in easiest way. program can communicate with other thread, other program, other computer in the network with same code.

- it provides the easy way to build decentralised secured network with easy sharing of resources/devices, easy add/remove nodes (computers), easy communication between nodes.
- it based around a maybe fastest virtual machine with lowest dependensies to hardware.
- it has included jit possibility that can be enabled or disabled in any time.
- it has included source level debugger.
- it has included esy to use tools to extend with C (to embed just rewrite main foo).
- it contain tools for make distributions.
- internal code of it is thery clean, understandeable and changeable (http://lynxline.com/projects/lab ... os-to-raspberry-pi/ , https://bitbucket.org/floren/inferno/wiki/Home , http://ipn.caerwyn.com/)

the input language of inferno - limbo is very match to Go (the fact is the limbo is the father of Go)

book/tutorial/docs about inferno/limbo -
http://doc.cat-v.org/inferno/boo ... ramming_with_limbo/
http://doc.cat-v.org/inferno/4th_edition/

how to extend with C - https://powerman.name/doc/Inferno/c_module_en
how to make filesistem (device or other) node - http://debu.gs/entries/inferno-part-3-let-s-make-a-filesystem

a big collection of modules - https://bitbucket.org/mjl/


only one disadvantage is for me - not fine interface. it designed using Tk and looks as Tk.
and one of reasons why i began to port clutter - i want to make better look to inferno. android is much harder in programming/changing, much slower and take too many of RAM as it have not very good VM (fort like).


here -
https://mega.nz/#F!ZshHFJ5J!8-TKqn9gTKZh6QybGKiAjg
is a prebuit for opi-armhf inferno package (sources are from https://bitbucket.org/inferno-os/inferno-os).
- to run it - unpack, enter to inferno-os folder and run ./emu.sh
- to change starting options - uncomment strings/edit options in the emu.sh

(hw.b in the root folder is a helloword sample. to compile it type in the shell "limbo -g hw.b")
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list