View Full Version : How can I load a tga file into a panel?
I am trying to write some dialog box similar to the one that is opened when you choose "LOAD GAME" from the HL2 game menu.
I save tga files during the game, and I want to be able to display them on my dialog.
Does anyone know how I can create an image from a tga file? Or does anyone know where I can find the code implementing the dialog opened by "LOAD GAME"?
07-16-2007, 07:45 AM
TGA Files aren't supported, only VTFs are. And the Load Game dialog is closed-source as a part of GameUI.dll
Are you sure tga files are not supported. when a game is saved, only a tga file is created (in the SAVE directory) without any vtf - there must be a way I can do the same..??? just I didn't figure yet how.
07-18-2007, 06:21 AM
OK totaly dont listen to any one trying to give you help is the best way to go ...
No really i mean it ...
Your still here? ....
You have to use vtf files. Have a google or look in the wiki tga files (or any other images) are not supported for in game use. Sure it can write out a jpg or tga but that is completly diffrent from rendering them.
08-06-2007, 08:48 AM
Bump. Actually I believe its possible to load TGA files onto a VGUI Panel.
\Public\Bitmap\tgaloader.h contains a few useful functions. ;)
08-06-2007, 11:03 AM
It's about 5 seconds to convert a targa into a vtf/vmt anyway...
For what its worth though, doesn't the MOTD panel support HTML, including images, which, I guess, don't have to be targas.
08-06-2007, 11:36 AM
He basically just wants to make it so when the player does a "Load Game" they see a screenshot of the game they last played. He's not trying to render it mid-game or what not.
I did some poking around and found in cubemap.cpp they create .vtf files from your screen. They basically create a new VTF image using CreateVTFTexture(), copy the unsigned char *data (which is every pixel), then memcpy their own texture data into it, and finally save it to a file.
From there just build yourself a .vmt to fit with the FileSystem and you should be able to load it without a problem when you want to display it, without ever exiting the game.
It won't take 5 seconds, maybe about 1-3 seconds which is perfectly fine for when the player "SAVES" their game.
So the files of interest are:
vBulletin® v3.8.7, Copyright ©2000-2014, vBulletin Solutions, Inc.