Unexpected behavior of flipHoriz in imageStim

Hi,

when changing the flipHoriz property of an imageStim, it seems to matter when the draw command is issued. In the code below, the textStim flips as expected but the imageStim does not.

from psychopy import visual, event, core
import numpy as np

win = visual.Window(size=(800, 600), fullscr=False, units='pix',useFBO=False)
im = -np.ones((100, 150, 3))
im[:, :75] = [1, -1, -1]  # Red half

image = visual.ImageStim(win, name="image", image=im, units='pix')
text = visual.TextStim(win, name="text", text="Hello World", pos=(0, -100), height=30, color='white', units='pix')

def flip_stims_horiz():
    image.setFlipHoriz(not image.flipHoriz)
    text.setFlipHoriz(not text.flipHoriz)

# using draw __before__ flipping does flip text but not image 
image.autoDraw = False
text.autoDraw = False
while True:
    if event.getKeys(keyList=["escape"]):
        break
    image.draw()
    text.draw()
    flip_stims_horiz()

    win.flip()  
    core.wait(0.5)

When using autoDraw or drawing before flip_stims, it works again. So two things are counterintuitive to me: 1. I have to do the flipHoriz after drawing and 2. it behaves different for an imageStim and a textStim. Is this a bug or expected behavior?

Psychopy 2026.1.3 with python 3.10 on Windows 11

The solution seems to be to manually set
image._needTextureUpdate = True
when changing image.flipHoriz