Hi List,
I posted this on the forums a couple of days ago but didn't get a
response, I thought I'd try here too.
I've written my own menu for Source 2007, and would like to replicate
the save functionality - showing thumbnails next to save entries on
the menu.
As those are saved as TGA in the default incarnation at a fixed size,
I thought it'd be easier to try and save my own in VTF format, based
on the _rt_SmallFB0 render target so they can be added to VGUI
elements without much effort.
My code so far:
ITexture *rt = materials->FindTexture("_rt_SmallFB0",
TEXTURE_GROUP_RENDER_TARGET);
IVTFTexture *pDestTexture = CreateVTFTexture();
pDestTexture->Init(rt->GetActualWidth(), rt->GetActualHeight(),
rt->GetMappingDepth(), rt->GetImageFormat(), rt->GetFlags(), 1);
// Copy or convert rt to pDestTexture here (somehow)
CUtlBuffer outputBuf;
pDestTexture->Serialize(outputBuf);
DestroyVTFTexture(pDestTexture);
g_pFullFileSystem->WriteFile("test.vtf", "MOD", outputBuf);
outputBuf.Clear();
I can't see a way to copy the ITexture to the IVTFTexture... so I
figured I'm probably doing it wrong.
Does anyone know how to export a render target's contents as a VTF?
Thanks.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders