|
|
#1 |
|
Guest
Posts: n/a
|
How can I load a tga file into a panel?
Hello,
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"? Thanks, Shir |
|
|
|
#2 |
![]() Join Date: Jun 2007
Reputation: 0
Posts: 63
|
TGA Files aren't supported, only VTFs are. And the Load Game dialog is closed-source as a part of GameUI.dll
|
|
|
|
|
|
#3 |
|
Guest
Posts: n/a
|
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.
gogo |
|
|
|
#4 |
![]() Join Date: Mar 2006
Reputation: 36
Posts: 1,715
|
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. |
|
|
|
|
|
#5 |
![]() Join Date: Mar 2004
Reputation: 60
Posts: 675
|
Bump. Actually I believe its possible to load TGA files onto a VGUI Panel.
\Public\Bitmap\tgaloader.h contains a few useful functions.
|
|
|
|
|
|
#6 |
![]() Join Date: Jul 2007
Reputation: 84
Posts: 2,170
|
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. |
|
|
|
|
|
#7 |
![]() Join Date: Feb 2006
Reputation: 7
Posts: 90
|
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: cubemap.cpp tgaloader.h imaterialsystem.h Last edited by One3yed: 08-06-2007 at 11:40 AM. |
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|