Sign in to follow this  
Code Is Your Friend

Loading or converting a jpg

Recommended Posts

After alot of searching and alot of dead ends I have decided to just ask and hope for the best, I am trying to load a jpg to a direct x surface using c++. The problem is for all the sites on google about this, they dont really help. And most were written back in 02 and 03 and mention sites that no longer exist. Now I don't care if its a jpg when it hits the surface, or if you know a way to simple convert it to a bmp. I just want a point in the right direction. anyone? Thanks, Matt

Share this post


Link to post
Share on other sites
There's no such thing as a "DirectX surface". There is however DirectDraw surfaces and Direct3D surfaces. If you're using Direct3D, there's D3DXLoadSurfaceFromFile. If you're using DirectDraw, then you'll have to do the JPEG decoding yourself - which is one of the many reasons that DirectDraw is not recommended, and rendering 2D with Direct3D is preferable.

Share this post


Link to post
Share on other sites
I think the Texture tool in dxsdk can do it too. dds is fine too.

Or you could do your own converter with D3DXCreateTextureFromFile() and D3DXSaveTextureToFile(). This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this