11import Sofa
22import SofaTypes
33
4+ from PIL import Image
5+
46class DrawingExamples (Sofa .Core .Controller ):
57 def __init__ (self , * args , ** kwargs ):
68 # These are needed (and the normal way to override from a python class)
79 Sofa .Core .Controller .__init__ (self , * args , ** kwargs )
810
911 self .target = kwargs .get ("target" , None )
1012 self .mo = kwargs .get ("mo" , None )
13+ self .img = Image .open ("oip.jpeg" ).convert ("RGBA" )
1114
1215 def draw (self , visual_context ):
1316 dt = visual_context .getDrawTool ()
@@ -23,10 +26,14 @@ def draw(self, visual_context):
2326 dt .drawText (10 ,10 , 12 , "Overlay text" )
2427
2528 dt .drawFrames (self .mo .position , SofaTypes .Vec3d (0.1 ,0.1 ,0.1 ))
29+ w ,h = self .img .size
30+ dt .drawRGBAImage ("memory" , SofaTypes .Vec3d (0.0 ,0.0 ,0.0 ), w ,h , 32 , self .img .tobytes ())
31+ #dt.drawRGBAImage("image", SofaTypes.Vec3d(0.0,0.0,0.0), "oip.jpeg")
2632
2733def createScene (root ):
2834 root .dt = 0.01
2935 root .bbox = [[- 1 ,- 1 ,- 1 ],[1 ,1 ,1 ]]
36+ root .addObject ('RequiredPlugin' , name = "Sofa.GL.Component.Shader" )
3037 root .addObject ('DefaultVisualManagerLoop' )
3138 root .addObject ('DefaultAnimationLoop' )
3239
0 commit comments