Render to Texture

31.  Select the python script named RenderToTexture.py
  • Logic Editor >> Controllers >> Python Controller
     
  • Script >> Script List >> RenderToTexture.py
Note:
  • Earlier, we opened RenderToTexture.py in the Text Editor 
     
  • That added RenderToTexture.py to the game engine's python script list
32.  Add a game property to Monitor
  • Logic Editor menu >> View >> Properties
  • Properties tab >> Add Game Property button
Note:
  • We are adding the material name as a python variable (a game property).
     
  • This way we can use one (and only one) python script for ALL of the Render To Texture objects in the game.
33. Property Name: material  --  Property Type: String
  • Logic Editor >> Properties tab >> Property Name: material
     
  • Logic Editor >> Properties tab >> Property Type: String
Note:
  • The string Game Property must be named material.  
     
  • The code in RenderToTexture.py looks for a string Game Property named material.