Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

IFooBar

how would u load in an adobe photoshop image into a texture?

This topic is 5783 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello i was ondering how you would load in an adob photo shop image or maybe a corel photopain image into directx. something along teh lines of D3DXCreateTextureFromFile(...)? would you have to parse teh file yourself? and how would you do that? where do i start? thanks


Al **MY HQ**

Share this post


Link to post
Share on other sites
Advertisement
If you''re talking about loading a .PSD file, then you''d have to parse the file yourself (start at www.wotsit.org).

Alternatively you or the artist would simply save into a common format such as .TGA or .PNG and then use D3DXCreateTextureFromFile().

D3DXCreateTextureFromFile() won''t load .PSDs since they''re not a common format - that''s the internal format for Photoshop - it isn''t intended to be a final asset format.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
hello

what if i want to export from PSD into my own format...say i name this format .ALF ? would i have to hack into Adobe photoshop to make an exporter to the .ALF format or are there some coomon steps that one must take to make an exporter?

where do i start?

thanks again





Al
**MY HQ**

Share this post


Link to post
Share on other sites
You can use the Photoshop SDK to learn how to create an export plugin, or you can use Photoshop to save in another format like BMP or TGA.

The D3DX library comes with functions to load textures from common formats like BMP and TGA.

So you don''t really need your own format.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites
yeah i know it does all that. but all those comemrcial games have formats that u cant open with a normal pain program...i wanna give a shot at something like that. after i make my own image format then ill try to make my own text file format.. so any advice on doing that ... do u even need directX to do that?? ie load teh image into a texture?






Al
**MY HQ**

Share this post


Link to post
Share on other sites
Or just save the file as RAW in Photoshop. Nothing can open that without knowing the format, which you do. You can still load them in DirectX using the D3DX functions. Just load the file into memory yourself then use the D3DX load-texture-from-memory function.

Sounds like you''re wasting time that would be better spent elsewhere in your project though.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites
Quick aside:

1. I''d always use binary .PPM files rather than plain .RAW. A .PPM file is simply raw data except it has a very simple ASCII header immediately before the data so you get raw data with the benefits of being able to pick any file and know its dimensions. PPMs are also dead easy to write (i.e. a single fprintf() for the header followed by an fwrite() for data.

2. Most PC games use common formats like TGA!. Sometimes the extensions might be different, and commonly they''ll be bundled into a large PAK files, but it simplifies the whole process to use a common format. A few games use some semi specialised formats such as .DXT/.S3TC (Direct3D/S3TC compressed textures & mipmap chains) or meshes with embedded textures (like RAD Gametools Granny).

For the PC there isn''t any justification for making your own image file format these days! Consoles however are a different matter because you know exactly what the destination hardware version of the texture is going to be like so you can pre-swizzle and block in your own format.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
If having end users change your images is a real concern for you then just encrypt the image files with an external program and decrypt them either into memory or a temp file from your main game executable and load it as a texture from there. If someone knows your encryption algorithm, they''ll still be able to change your images but it''s highly unlikely that anyone will be bothered to do all that.

-Auron

Share this post


Link to post
Share on other sites
Just stick your pics and textures into a dll as resources.
There are many DX helper functions that can load them from
resources. It is real easy to make and use one.
It does encapsulate all of your pics into one file, but
that makes even more hard to hack.

Share this post


Link to post
Share on other sites
thanks everyone. i really like the dll ideas. but the point of me doing this is just to learn something new...thats all. so ill propbably end up trying all those things. and S1CA, you gave me an idea





Al
**MY HQ**

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!