CreateNewTextureID: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
 
m (navbar, categorize, and sample)
Line 1: Line 1:
{{navbar|DrawGetTextureId|ISurface|DrawSetTexture}}
=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 a [[DrawSetTexture]] function 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 );
[[Category:ISurface]]

Revision as of 18:16, 9 May 2006


int CreateNewTextureID( bool procedural = false )

Use this before a DrawSetTexture function 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 );