CreateNewTextureID: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (navbar, categorize, and sample)
mNo edit summary
Line 1: Line 1:
{{navbar|DrawGetTextureId|ISurface|DrawSetTexture}}
{{navbar|DrawGetTextureId|ISurface|DrawSetTextureFile}}
=int CreateNewTextureID( bool procedural = false )=
=int '''CreateNewTextureID'''( bool procedural = false )=
Use this before a [[DrawSetTexture]] function and after [[DrawGetTextureId]] to initialize a new texture ID.
Use this before [[DrawSetTextureFile]] or [[DrawSetTextureRGBA]] and after [[DrawGetTextureId]] to initialize a new texture ID.
==Sample==
==Sample==
  currentId = surface()->'''DrawGetTextureId'''( texturename );
  currentId = surface()->[[DrawGetTextureId]]( texturename );
  if ( currentId == -1 )
  if ( currentId == -1 )
  {
  {
  currentId = surface()->[[CreateNewTextureID]]();
  currentId = surface()->'''CreateNewTextureID'''();
  }
  }
  surface()->[[DrawSetTextureFile]]( currentId, texturename, false, true );
  surface()->[[DrawSetTextureFile]]( currentId, texturename, false, true );
[[Category:ISurface]]
[[Category:ISurface]]

Revision as of 18:23, 9 May 2006


int CreateNewTextureID( bool procedural = false )

Use this before DrawSetTextureFile or DrawSetTextureRGBA and after DrawGetTextureId to initialize a new texture ID.

Sample

currentId = surface()->DrawGetTextureId( texturename );
if ( currentId == -1 )
{
	currentId = surface()->CreateNewTextureID();
}
surface()->DrawSetTextureFile( currentId, texturename, false, true );