I’m having some trouble getting VideoTexture to work while running a game in-browser using Burster.
To clarify a few things first:
-Everything is setup and working fine when running from blender itself
-Im aware that Burster blocks several modules and functions due to security risks, but as far as I can see from [this] page, everything Im using is allowed - note that the VideoTexture module is stated as being allowed
-Im not trying to import and run a video file (disallowed by Burster), I’m simply using ‘renderToTexture’ - think of a security camera setup, another camera in the scene is having its view rendered onto a plane of a computer screen within the game, ie everything is within the one scene.
The script is as follows (from www.tutorialsforblender3d.com):
#import GameLogic
import GameLogic
# get current scene
scene = GameLogic.getCurrentScene()
# get the current controller
controller = GameLogic.getCurrentController()
# get object script is attached to
obj = controller.owner
# check to see RenderToTexture has been added
if "RenderToTexture" in obj:
# update the texture
obj["RenderToTexture"].refresh(True)
# if RenderToTexture hasn't been added
else:
# import VideoTexture module
import VideoTexture
# get a list of objects in the scene
objList = scene.objects
# get camera name being used for render to texture
camName = obj['cam']
# get camera object
cam = objList[camName]
# get the texture material ID
matID = VideoTexture.materialID(obj, "MA" + obj['material'])
# set the texture
renderToTexture = VideoTexture.Texture(obj, matID)
# get the texture image
renderToTexture.source = VideoTexture.ImageRender(scene,cam)
# save RenderToTexture as an object variable
obj["RenderToTexture"] = renderToTexture
If anyone can point out the problem here, or even suggest a solution (if there is one), that would be great.