Enable and Disable textures in game, possible?

Hi Blenderartists,

I would like to ask if there is a possibility to turn on and off the reflection/ specular texture during the game. I guess there must be that way in many games to adjust the visual quality, in case the computer cannot handle it. The more texture layers an object has, the more ram it will need.

I hope you guys could help me, thanks in advance.


It’s not possible, though it’s possible to replace the image with a “null” version, check video texture module on the docs.

Thanks Jackii for your quick answer. Where could find the video texture module and replace an image?

From the docs:


from bge import logic
from bge import texture


def createTexture(cont):
    """Create a new Dynamic Texture"""
    obj = cont.owner

    # get the reference pointer (ID) of the internal texture
    ID = texture.materialID(obj, 'IMoriginal.png')

    # create a texture object
    object_texture = texture.Texture(obj, ID)

    # create a new source with an external image
    url = logic.expandPath("//newtexture.jpg")
    new_source = texture.ImageFFmpeg(url)

    # the texture has to be stored in a permanent Python object
    logic.texture = object_texture

    # update/replace the texture
    logic.texture.source = new_source
    logic.texture.refresh(False)


def removeTexture(cont):
    """Delete the Dynamic Texture, reversing back the final to its original state."""
    try:
        del logic.texture
    except:
        pass

Thanks again. I may have to spend a little time to understand this code. This thread is solved.