Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Thread Tools Display Modes
Old 07-16-2007, 12:14 AM   #1
Posts: n/a
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"?
Reply With Quote
Old 07-16-2007, 07:45 AM   #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
Wraiyth is offline   Reply With Quote
Old 07-18-2007, 01:16 AM   #3
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.

  Reply With Quote
Old 07-18-2007, 06:21 AM   #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.
lodle is offline   Reply With Quote
Old 08-06-2007, 08:48 AM   #5
Join Date: Mar 2004
Reputation: 60
Posts: 678
Bump. Actually I believe its possible to load TGA files onto a VGUI Panel.

\Public\Bitmap\tgaloader.h contains a few useful functions.
ProZak is offline   Reply With Quote
Old 08-06-2007, 11:03 AM   #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.
Winston is offline   Reply With Quote
Old 08-06-2007, 11:36 AM   #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:

Last edited by One3yed: 08-06-2007 at 11:40 AM.
One3yed is offline   Reply With Quote

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -7. The time now is 08:14 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2015, All Rights Reserved.