Microsoft DirectX 8.1 (Visual Basic)

Direct3DTexture8.LockRect

Locks a rectangle on a texture resource.

object.LockRect( _ 
    Level As Long, _ 
    LockedRect As D3DLOCKED_RECT, _ 
    RECT As Any, _ 
    Flags As Long)

Parts

object
Object expression that resolves to a Direct3DTexture8 object.
Level
Specifies the level of the texture resource to lock.
LockedRect
A D3DLOCKED_RECT type, describing the locked region.
RECT
Rectangle to lock. Specified by a RECT type, or ByVal 0 to expand the dirty region to cover the entire texture.
Flags
A combination of zero or more valid locking flags defined by the CONST_D3DLOCKFLAGS enumeration, describing the type of lock to perform.

Error Codes

If the method fails, an error is raised and Err.Number can be set to D3DERR_INVALIDCALL.

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

Textures created in D3DPOOL_DEFAULT are not-lockable.

For performance reasons, dirty regions are only recorded for level zero of a texture. Dirty regions are automatically recorded when LockRect is called without D3DLOCK_NO_DIRTY_UPDATE or D3DLOCK_READONLY. See Direct3DDevice8.UpdateTexture for more information.

The only lockable format for a depth-stencil surface is D3DFMT_D16_LOCKABLE.

A multisample backbuffer cannot be locked. Video memory textures cannot be locked, but they must be modified by calling Direct3DDevice8.CopyRects or Direct3DDevice8.UpdateTexture. There are exceptions for some proprietary driver pixel formats that Microsoft® DirectX® 8.x does not recognize. These can be locked.

See Also

Direct3DTexture8.UnlockRect