Jump to content
  • Advertisement


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


How do you write to a IDirect3DTexture8???

This topic is 5744 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

I want to go in and write to the data of a IDirect3DTexture8 surface. I want to change the color info on individual pixels on it as if it was a bitmap. How do I do it? Ive read all over the DirectX documentation and can find no info on how to do this. Even a link to this would be highly appreciated. Just something to point me in the right direction.

Share this post

Link to post
Share on other sites
Thanks Niyaw. Ok I gothca I think. You are saying use IDirect3DTexture8::D3DLOCKED_RECT??? Its the closest to what you described...

if so its parameters are:
UINT Level,
D3DLOCKED_RECT* pLockedRect,

a few more questions
1) Level... What is this? totally vague in the SDK.
2) pLockedRect which has D3DLOCKED_RECT:: Pitch and D3DLOCKED_RECT:: PBits as members. I assume Pitch is the size in bytes of a row of pixels for this texture which relates back to how the texure was created, ie the size of a pixel defined by D3DFORMAT divided the width of the texture? And PBits is the byet offest to the first pixel?
3) pRect is the x,y pixel offset of the area to be locked "indepent" of a pixel's size in bytes?
4) Flags... Got this one no prob. Its the only straightforward description in the SDK for this function.

[ edit to remove the tongue smiley faces... no tongues in this post thank you, although it did look funny... ]

[edited by - Delta69 on February 1, 2003 2:42:00 AM]

Share this post

Link to post
Share on other sites

1: this has to do with mipmaps. sdk docs should have a section on mipmapping, read it if you''re interested. usually you use level 0.

2: pbits is the pointer to beginning of texture bits, not an offset from anything. you got pitch right, it''s the width of one row of pixels, in bytes. note that it may be more than just number of pixels multiplied by number of bytes per pixel due to alignment.

3: yes, but it''s not just offset; you can lock arbitrary regions of a texture.

4: ok, but keep in mind that proper use of lock flags is crucial to high performance of your application.

Share this post

Link to post
Share on other sites
1) gothca.

2) understood on all points you made.

3) now Im confused again. I didnt notice that it was an array of RECTS in the SDK until I read your last post. What if the array of RECTS overlap? Or are they not allowed to overlap? Thats the only way I can see if this stuff works...

4) duly noted. ran into this problem before with other flags for other functions.

thanks Niyaw I know this stuff probably comes up a lot around here and Im sorry if Im asking frequently asked questions.

[edited by - Delta69 on February 1, 2003 4:28:28 AM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!