DrawGetTextureId: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
m (added class)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
=int DrawGetTextureId( char const *filename )=
{{navbar-first|ISurface|CreateNewTextureID}}
Use this function before [[CreateNewTextureID]] to make sure you don't make multiple texture IDs for the same material.
=int [[ISurface]]::'''DrawGetTextureId'''( char const *filename )=
Use this function before [[CreateNewTextureID]] to make sure you don't reference the same material with multiple texture IDs.
==Sample==
==Sample==
  currentId = surface()->'''DrawGetTextureId'''( texturename );
  currentId = surface()->'''DrawGetTextureId'''( texturename );
Line 6: Line 7:
  {
  {
  currentId = surface()->[[CreateNewTextureID]]();
  currentId = surface()->[[CreateNewTextureID]]();
surface()->[[DrawSetTextureFile]]( currentId, texturename, false, true );
  }
  }
surface()->[[DrawSetTextureFile]]( currentId, texturename, false, true );
[[Category:ISurface]]

Latest revision as of 19:32, 28 June 2006

Return to ISurface CreateNewTextureID

int ISurface::DrawGetTextureId( char const *filename )

Use this function before CreateNewTextureID to make sure you don't reference the same material with multiple texture IDs.

Sample

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