Example #1
0
 def __init__(self):
     super()
     self.width = 100
     self.height = 100
     self.bpp = 4
     self.pixelbuffer = bytearray(self.width*self.height*self.bpp)
     self.SetColour(255,255,255,255)
     GS_BGRA = 5
     LEVELS =1  
     FLAGS = 1<<1
     libobs.obs_enter_graphics()
     self.tex = libobs.gs_texture_create(self.width,
                                      self.height,
                                      libobs.GS_BGRA,
                                      LEVELS,
                                      self.pixelbuffer,
                                      libobs.GS_DYNAMIC)
     libobs.obs_leave_graphics()
     print (self.tex)
Example #2
0
 def render(self,effect):
     libobs.blog("render")
     rand = randint(0,255)
     self.SetColour(rand,
                    rand,
                    rand,
                    255)
     try:
         libobs.obs_enter_graphics()
         libobs.gs_texture_set_image(self.tex,self.pixelbuffer,self.width*self.bpp,False)
         libobs.gs_reset_blend_state()
         param = libobs.gs_effect_get_param_by_name(effect,"image")        
         libobs.gs_effect_set_texture(param,self.tex)
         libobs.gs_draw_sprite(self.tex,0,self.width,self.height)
     except:
         pass
     finally:
         libobs.obs_leave_graphics()
     print(param)
     print("render")
     pass
Example #3
0
 def destroy(self):
     print(self.tex)
     libobs.obs_enter_graphics()
     libobs.gs_texture_destroy(self.tex)
     libobs.obs_leave_graphics()