Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

spade

CreateImageSurface vs RenderTarget

This topic is 5630 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!