materialsystem/cmaterialsystem.cpp
bool CMaterialSystem::UpdateLocalGamerpicTexture(
	ITexture			*pTexture, 
	DWORD				userIndex )
{
	Assert( pTexture != NULL );
	Assert( pTexture->GetActualWidth() == g_GamerpicSize && pTexture->GetActualHeight() == g_GamerpicSize );
	Assert( pTexture->GetImageFormat() == g_GamerpicFormat );
	Assert( userIndex >= 0 && userIndex < 4 );

	// lock
	CPixelWriter writer;
	g_pShaderAPI->ModifyTexture( ((ITextureInternal*)pTexture)->GetTextureHandle( 0 ) );
	g_pShaderAPI->TexLock( 0, 0, 0, 0, g_GamerpicSize, g_GamerpicSize, writer );

	// Write the gamerpic to the texture.
	BYTE *pBuf = (BYTE*)writer.GetPixelMemory();
	DWORD retVal = XUserReadGamerPicture( userIndex, FALSE, pBuf, g_GamerpicSize * writer.GetPixelSize(), g_GamerpicSize * writer.GetPixelSize(), NULL );

	// unlock
	g_pShaderAPI->TexUnlock();

	return (retVal == ERROR_SUCCESS);
}
//-----------------------------------------------------------------------------
// Update the given texture with the player gamerpic for the local player at the given index.
// Note: this texture must be the correct size and format. Use CreateGamerpicTexture.
//-----------------------------------------------------------------------------
Update the given texture with the player gamerpic for the local player at the given index.
Note: this texture must be the correct size and format.
Update the given texture with the player gamerpic for the local player at the given index . Note : this texture must be the correct size and format .
bool CMaterialSystem::UpdateLocalGamerpicTexture(
	ITexture			*pTexture, 
	DWORD				userIndex )
{
	Assert( pTexture != NULL );
	Assert( pTexture->GetActualWidth() == g_GamerpicSize && pTexture->GetActualHeight() == g_GamerpicSize );
	Assert( pTexture->GetImageFormat() == g_GamerpicFormat );
	Assert( userIndex >= 0 && userIndex < 4 );
	CPixelWriter writer;
	g_pShaderAPI->ModifyTexture( ((ITextureInternal*)pTexture)->GetTextureHandle( 0 ) );
	g_pShaderAPI->TexLock( 0, 0, 0, 0, g_GamerpicSize, g_GamerpicSize, writer );
	BYTE *pBuf = (BYTE*)writer.GetPixelMemory();
	DWORD retVal = XUserReadGamerPicture( userIndex, FALSE, pBuf, g_GamerpicSize * writer.GetPixelSize(), g_GamerpicSize * writer.GetPixelSize(), NULL );
	g_pShaderAPI->TexUnlock();
	return (retVal == ERROR_SUCCESS);
}
bool CMaterialSystem :: UpdateLocalGamerpicTexture ( ITexture * pTexture , DWORD userIndex ) { Assert ( pTexture != NULL ) ; Assert ( pTexture -> GetActualWidth ( ) == g_GamerpicSize && pTexture -> GetActualHeight ( ) == g_GamerpicSize ) ; Assert ( pTexture -> GetImageFormat ( ) == g_GamerpicFormat ) ; Assert ( userIndex >= 0 && userIndex < 4 ) ; CPixelWriter writer ; g_pShaderAPI -> ModifyTexture ( ( ( ITextureInternal * ) pTexture ) -> GetTextureHandle ( 0 ) ) ; g_pShaderAPI -> TexLock ( 0 , 0 , 0 , 0 , g_GamerpicSize , g_GamerpicSize , writer ) ; BYTE * pBuf = ( BYTE * ) writer . GetPixelMemory ( ) ; DWORD retVal = XUserReadGamerPicture ( userIndex , FALSE , pBuf , g_GamerpicSize * writer . GetPixelSize ( ) , g_GamerpicSize * writer . GetPixelSize ( ) , NULL ) ; g_pShaderAPI -> TexUnlock ( ) ; return ( retVal == ERROR_SUCCESS ) ; }
Update the given texture with the player gamerpic for the local player at the given index.
Update the given texture with the player gamerpic for the local player at the given index .
// lock // Write the gamerpic to the texture. // unlock