-
|
I want to show video frames within the HoloLens app. Therefore, I am sending accross http messages that contain image/jpeg with 640x480. After receiving them in the HL app, I transfer each frame into a Sprite using Tex.FromColors() followed by Sprite.FromTex(). Since I am trotteling the video frames from the sender side to 10 fps that is displayed nicely and with not such a bad latency. However, after some time it seems the incoming video frames cause the app to crash. This does not happen in the emulator. As far as I understand, Tex.FromColors / Sprite.FromTex reserves memory on the GPU, hence, it should not be called with high frequency, right? Any way to boost this for high frequency images? In 2D UI's you typically use WriteableBitmap for such a case, which re-uses the memory and just overrides the color information for each pixel. Any way to do this with SK? Also I do not see any Dispose() functions for the more heavy weight elements such as Tex. How do you propose to release them? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
You'll want to create a |
Beta Was this translation helpful? Give feedback.
Tex.FromColorscreates a whole new texture object, and sets it up as an immutable graphics resource. Which is a little slower to create, and definitely isn't friendly towards frequent creation, but theoretically sits in a faster chunk of GPU memory. The best way to do what you're trying to do is to re-use a texture+sprite that you already have! If you're usingSpriteType.Single, then it does maintain a direct reference to theTexasset that's provided, so you won't need to create a newSpriteasset either.You'll want to create a
new Tex(TexType.ImageNoMips | TexType.Dynamic), and then update its contents each time withTex.SetColors. If you update an image withTex.SetColorsmore than on…