programming using pyclutter

情到浓时终转凉″ 提交于 2019-12-04 17:16:15

This will not work, cause cogl is an abstraction to use OpenGL. In OpenGL world, the drawing must be done for everyframe. That's mean, your code will be executed only once, as soon as you window will flip, you'll not see the line. You can create a custom actor for that, and put your instruction in the do_paint() method :

class MyDrawing(clutter.Actor):
    __gtype_name__ = 'MyDrawing'
    def do_paint(self):
        clutter.cogl.set_source_color4ub (255,0,0,255)
        clutter.cogl.path_line(100,100,200,200)
        clutter.cogl.path_stroke()

And then, use it in your example like the Text actor:

stage.add(MyDrawing())
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!