Jump to content
  • Advertisement

Archived

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

TechnoCore

edit pixels within a texture or sprite

This topic is 5633 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! I''m making a minimap, and want to paint in the units, each a pixel in size, into a 128*128 texture. Should i use this for making my texture... result=D3DXCreateTexture(m_pd3dDevice, 128,128, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_pMMTexture1); How do i then lock it and get a pointer to an area to write some dwords to ? Use this ? m_pMMTexture1->LockRect(0,&LRect,NULL,D3DLOCK_DISCARD); But where''s the pointer i need ? Im going crazy over all these different texture and surfice functions... dont know which to use for what. Thanks for any help i can get...

Share this post


Link to post
Share on other sites
Advertisement
quote:
How do i then lock it and get a pointer to an area to write some dwords to ?
Use this ?
m_pMMTexture1->LockRect(0,&LRect,NULL,D3DLOCK_DISCARD);


You''re almost there--the D3DLOCKED_RECT structure has two members. The first, pBits, is a pointer to the texture''s data; the second, Pitch, tells you how wide a row is (in bytes), which is important, since you may have more than 128 bytes per row (DirectX does things like that at times).

Hope that helps.

-Odd the Hermit

Share this post


Link to post
Share on other sites
Hey !
Thanks.

Can i use the sprite->draw to get it on the screen?
Cant seem to make it work when i create the sprite with
D3DXCreateTexture. I have no such problems when loading a the texture from a file from start instead.

Any specials for sprites ?

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!