From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.

A TextureID is an internal number of a graphic used by GZDoom (contrary to the name, this includes any type of graphic, such as level textures, sprites, and graphics).

The TextureID struct contains methods that can be utilized on TextureID pointers. TextureID of an image can be obtained and manipulated by using the methods defined in the TexMan struct.



All of these methods are dynamic and must be called on a TextureID pointer.

  • bool IsValid()
Returns true if the TextureID is a valid texture that can be rendered. (This means the texture exists and isn't a null texture.)
  • bool IsNull()
Returns true if the TextureID is a null texture. (This means the texture exists but is explicitly defined as null.)
  • bool Exists()
Returns true if the TextureID is an existing texture (returns true for null textures as well).
  • void SetInvalid()
Marks the TextureID pointer as invalid for future checks.
  • void SetNull()
Marks the TextureID pointer as null for future checks. This is necessary, because something like foo = null doesn't work on TextureID-type values.

Existing, null and valid textures

The relation between IsValid(), IsNull() and Exists() checks works as follows:

Texture type Exists IsNull IsValid
Non-existent texture false false false
Null texture TRUE TRUE false
Regular texture TRUE false TRUE


  • TNT1A0 is considered a valid and non-null texture.
  • If an actor whose sprites don't exist are spawned dynamically in the world (via Spawn() or its derivatives), their sprites are dynamically remapped to TNT1 to avoid errors. As a result, calling IsValid() on the results of GetSpriteTexture() will yield a valid, non-null result. Use <statepointer>.ValidateSpriteFrame() to check a state is using an existing sprite.