Skip to content

Instantly share code, notes, and snippets.

@gashtio
Created October 24, 2012 14:30
Show Gist options
  • Save gashtio/3946392 to your computer and use it in GitHub Desktop.
Save gashtio/3946392 to your computer and use it in GitHub Desktop.
Obtaining the texture ID of a material in CryEngine 3
if (viewListener->GetTextureId() <= 0)
{
material = gEnv->p3DEngine->GetMaterialManager()->FindMaterial("materials/placeholder_1280_720");
if (material)
{
const STexSamplerRT& sampler = material->GetShaderItem().m_pShaderResources->GetTexture(EFTT_DIFFUSE)->m_Sampler;
const int texId = sampler.m_pITex->GetTextureID();
viewListener->SetTextureId(texId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment