Hi, I was looking to methods to have a texture out into plugin, I saw in template that texture is created by a shaderlike method.
In my work I have a fixed size bitmap actually builded in a custom thread, is it possible to copy that bitmap data, or build up a bitmapdatarray that can just be copied to texture out ?
yes, the ‘UpdateTexture’ method is called each frame. there you can copy the bytes into the texture. you can look into the TextureUtils.cs to see how you can lock a texture and fill it with data, for example the ‘CreateColoredTexture’ method is a good start.
unsafe private void FillTexure(uint* data, int row, int col, int width, int height)
ushort* pDepth = (ushort*)this.depth.GetDepthMapPtr().ToPointer();
ushort* pix = pDepth+col+row*width;
byte depthPixel = (byte)this.histogram[*pix](*pix);
//a pixel is just a 32-bit unsigned int value
var pixel = UInt32Utils.fromARGB(255, depthPixel, depthPixel, depthPixel);
//copy pixel into texture
TextureUtils.SetPtrVal2D(data, pixel, row, col, width);
mmmhhh, this is my third project in c# so im a littl bit confused , or better not skilled.
Anyway the histogram u are using with unsafe code is inside a locked loop or something by that, in my first view will be easier just to copy bitmapdata from the bitmap builded in openNi thread into a texture, seems to be easier :D
what i got so far, is the texture coming out, but colors are wrong, it always dispaly striped blue, like im coping values only into blue channel or soemthign like that, well als o something else is strange, by the way framerate is normal and smooth :D
the bitmap im trying to copy is a 640x480 Format24bppRgb