Archived

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

Accessing pixel information of textures

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

How can I access the pixel information of a Direct3dTexture8? I made a program a while back in DirectX 7 that randomly generates a rectangular planet surface and rendered it on a DirectDraw Surface. I want to alter the program so it can create a random planet texture that I can map onto a 3d sphere in Direct3D 8, any ideas on how I can do this? thanks

Share this post


Link to post
Share on other sites
As much as people hate other people regurtiatating information here is the function declaration for LockRect() of which you would use to access the information in a ID3DTexture8 with the pointer that it gives you.

HRESULT LockRect(
UINT Level,
D3DLOCKED_RECT* pLockedRect,
CONST RECT* pRect,
DWORD Flags
);

It's the same for surfaces and cube textures...

I haven't done this in a long time but if you read the documentation it should tell you how to address each pixel in the rect (texture).

[edited by - SnakeHunta on November 6, 2003 10:49:56 PM]

Share this post


Link to post
Share on other sites
It isnt a good idea to read the texture information off agp,unless the texture pool declares it as being in system memory I think it would be better to keep a copy yourself.

Share this post


Link to post
Share on other sites