Archived

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

brann

displaying a jpeg in direct3d

Recommended Posts

brann    122
i know it''s possible to do that by aplying the image as a texture on something, but isnt there a cleaner way to do that? (it''s for a splash screen) .. just wondering

Share this post


Link to post
Share on other sites
circlesoft    1178
No, because it''s direct3D, not direct2D. With the addition of ID3DXSprite, rendering your jpeg is extremetly easy, anyways

(In case you don''t know how)
1) Load the jpeg into an IDirect3DTexture9 (D3DXCreateTextureFromFile())
2) Create an ID3DXSprite object (D3DXCreateSprite())
3) sprite->Begin() (you shouldn''t need additional flags for a splash screen)
4) sprite->Draw() (pass in the texture)
5) sprite->End()


Dustin Franklin
Mircrosoft DirectX MVP

Share this post


Link to post
Share on other sites
brann    122
i have no D3DXCreateTextureFromFile() method, nor D3DXCreateSprite() ...

i'm using c#, and the latest directx sdk (summer update)

ideas?

(of course, i'm using Microsoft.DirectX and Microsoft.directX.Direct3D)

a lot of other stuff are working fine, such as rendering a 3d scene...

[edited by - brann on March 21, 2004 12:25:49 PM]

Share this post


Link to post
Share on other sites
brann    122
i''ve finally succeed to compile my code but it''s not working

here it is :
device.Clear(ClearFlags.Target, Color.BlueViolet, 1.0F, 0);
device.BeginScene();
Texture t = TextureLoader.FromFile(device, DxUtils.Configuration.ResourceRoot+ @"\\images\\aa.bmp");
Sprite s = new Sprite(device);
s.Begin(0);
s.Draw(t,new Rectangle(0,0,100,100),new Vector3(0,0,0),new Vector3(0,0,0),Color.Red);
s.End();

PrintString(150,150,Color.Black,"TEST");
device.EndScene();
device.Present();

the TEST string will appear, but not the texture

ideas?

Share this post


Link to post
Share on other sites