Solved

using directx to load TARGA files

Posted on 2004-10-09
3
297 Views
Last Modified: 2011-09-20
Hi experts,

i'm a beginner in directx programming, i would like to load a targa files using directx, can the directx load the RGB and the ALPHA channel? and how to display it in two different image? (1 for RGB and the other one for ALPHA channel?)

0
Comment
Question by:mamamia
  • 2
3 Comments
 
LVL 17

Expert Comment

by:davebytes
ID: 12277259
Well, yes, DirectX can load most major formats using D3DXLoadSurfaceFromFile:

pD3DDevice->CreateImageSurface(600,800,D3DFMT_X8R8G8B8 , &pD3DSurface);
D3DXLoadSurfaceFromFile(pD3DSurface, NULL, NULL, filepath ,NULL, D3DX_DEFAULT,0, NULL) ;

For more details look at:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/reference/d3dx/functions/texture/d3dxloadsurfacefromfile.asp

Now, if you want TWO different images, you'll need to create a second alpha-only surface, 'strip' the alpha bytes from the first surface and copy them in to the second surface.  I've not seen an 'automated' process for this -- you have to do it 'by hand' in a loop that walks the entire texture data.

-d

0
 

Author Comment

by:mamamia
ID: 12286116
i'm not sure whether i can use D3DFMT_A8 or D3DFMT_A8P8
anyone tried this before?
0
 
LVL 17

Accepted Solution

by:
davebytes earned 500 total points
ID: 12289748
A8 should work fine -- though of course everything depends on your board and drives. ;)

-d
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help about porting DirectX 9.0c to DirectX 11 5 645
hasOne  challenge 59 138
Need a nodal sequencing tool 3 94
Any Advice on Sonar / DAW freaky instruments? 2 61
What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question