Panda3D Manual: OnscreenImageJust like OnscreenText, you can use OnscreenImage as a quick way to put an image onscreen. Use an OnscreenImage whenever you want a quick way to display an ordinary image without a lot of fancy requirements. from direct.gui.OnscreenImage import OnscreenImage imageObject = OnscreenImage(image = 'myImage.jpg', pos = (-0.5, 0, 0.02)) If you want, you can change the image into another one using setImage(): imageObject.setImage('myImage2.jpg') When you want to take the image away, use: imageObject.destroy() The following keyword parameters may be specified to the constructor:
NOTE: To enable transparency in images, you must first set the TransparencyAttrib, otherwise the transparent parts of the image will be shown black: from pandac.PandaModules import TransparencyAttrib self.myImage=OnscreenImage(image = 'myImage.png', pos = (0, 0, 0)) self.myImage.setTransparency(TransparencyAttrib.MAlpha) Since GIF's are not supported you should use PNG or TGA if you need transparency. © Carnegie Mellon University 2010 |