CreateImageSurface vs RenderTarget
Hi Folks,
is there an easier way to get the pixels of a texture/image ?
For now I create an ImageSurface und get the backbuffer written in this struct. Is it possible to get the pixels without Rendering the whole stuff ?
I just want to get the pixels of an image...
Regards,
Tim
Hi - have you considered using Direct3DTexture8.GetSurfaceLevel to access the surface (or surfaces) associated with a texture? You can this lock this surface and access its pixels.
Hope this helps-
BM
Hope this helps-
BM
No I didn''t. Thanks
But I have several problems with this GetSurfaceLevel.
I want to do RenderToTexture in a different part of my app also.
Are there any good tutorials ?
Are there any boobytraps to watch for when setting the renderstages !?
Regards,
Tim
But I have several problems with this GetSurfaceLevel.
I want to do RenderToTexture in a different part of my app also.
Are there any good tutorials ?
Are there any boobytraps to watch for when setting the renderstages !?
Regards,
Tim
I struggled a bit with this too when working in C#/Dx9. For that case here is how you can create a texture and get direct access to the bits. I am currently using it for real-time light maps.
m_txrLightMapTexture = new Texture(m_d3dDevice, 256, 256, 1, 0, Format.A8R8G8B8, Pool.Managed);
uint[,] lm = (uint[,])m_txrLightMapTexture.LockRectangle(typeof(uint), 0, 0, 256, 256);
twiddle bits...
m_txrLightMapTexture.UnlockRectange(0);
This can be sped up I heard by changing to a 1d array, or using unsafe code and pointers.
m_txrLightMapTexture = new Texture(m_d3dDevice, 256, 256, 1, 0, Format.A8R8G8B8, Pool.Managed);
uint[,] lm = (uint[,])m_txrLightMapTexture.LockRectangle(typeof(uint), 0, 0, 256, 256);
twiddle bits...
m_txrLightMapTexture.UnlockRectange(0);
This can be sped up I heard by changing to a 1d array, or using unsafe code and pointers.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement