CreateNewTextureID: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
 
m (added class)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
=int CreateNewTextureID( bool procedural = false )=
{{navbar|DrawGetTextureId|ISurface|DrawSetTextureFile}}
Use this before a [[DrawSetTexture]] function and after [[DrawGetTextureId]] to initialize a new texture ID.
=int [[ISurface]]::'''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 );
}
[[Category:ISurface]]

Latest revision as of 19:32, 28 June 2006


int ISurface::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 );
}