ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.07k stars 1.28k forks source link

Overlay uses wrong size when reusing OpenGL texture name. #220

Open matzman666 opened 8 years ago

matzman666 commented 8 years ago

When applying an OpenGL texture to an overlay and the texture name that has already been used for an overlay texture before, the wrong size is used for the overlay.

How to reproduce:

McKay42 commented 7 years ago

This might be related to https://github.com/ValveSoftware/openvr/issues/216 and the caching of the texture/rendertarget size. Seems that it is only stored once, and then never invalidated.

RustyPaint commented 7 years ago

Similar problem. I'm using a tracked controller attached overly to display a status message. Basically the update is done like this:

Existing overlay is visible. Compute new message size. Compute new width based on message hight. Upload new texture to GL keeping same glBindTexture target. Set overlay width. Set overlay texture (with the same bind target).

There is a timer that will hide the message overlay after two seconds of no updates.

If the texture for the message changes size (do to the message changing), the overlay will show the old texture until some magic cached texture size is flushed in OpenVR. The "flush" is kind of random since it can sometimes update if there is a pause before the next texture upload or when the overlay is hidden for a short period before being shown again. Trying to hide, wait 3 frames and then show again is not enough for the magic "flush".

So I guess the question is, is there a way to flush the cached texture size?