Accessing pixel information of textures

Started by
3 comments, last by KevinCoyle 20 years, 6 months ago
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
Advertisement
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]
G''day!

This tutorial shows how to lock a texture and mess with its bits.
http://www.drunkenhyena.com/docs/d3d_tutorial.phtml#DHComputedAlpha


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena
Thanks for the help guys
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.

This topic is closed to new replies.

Advertisement