this is probably a question for our beloved devvvv’s.
I have some questions regarding writing plugins that produce textures.
In the template, in CreateTexture a function
TextureUtils.CreateTexture( device, w, h );
is used for creating a new texture.
I was trying (messing around for different reasons :) to do it myself using
new Texture(device, w, h, 0, Usage.None, Format.A8B8G8R8, Pool.Default)
but this fails with D3DERR_INVALIDCALL (-2005530516) because 1. i don’t know if this is possible and 2. maybe the Utils function does a lot of other stuff that I am unaware of.
Also, when I use the TextureUtils.CreateTexture function twice from within CreateTexture(device), things don’t seem to work. I am wondering why.
The reason I am experimenting with this is that I want to copy data to video memory, but I wanted to keep 2 different textures, to create some sort of double buffer, so that I could copy information to the texture that is not visible from a separate thread, and show the other texture, then switch them as needed, because the way the template is implemented is easy and clear, but speed really sucks a soon as textures start to grow and change often.
My ‘CreateTexture’ function (that is called whenever Reinitialize() is called), would not always create a new texture, but would simply return the ‘frontbuffer’ texture…
Maybe this is a bad idea and I should do it otherwise? What I can see now is that I have quite a good frame rate (because I am not blocking vvvv’s main thread while copying data), but since I could be writing to a texture while it is being shown on screen, I sometimes see frames that actually consist of 2 halves of 2 different frames. Another way would be to lock the texture while it is being written to or something but I don’t really know how i could do that either…
Any ideas? Things I missed, info I should check out? How does the VideoTexture node work (it’s something like that I need I guess)?