Click here to Skip to main content
15,884,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to load a mesh(.x) file in vc++windows forms and display in the form window. Can any one guide me how to load and display (.X) files in vc++ windows forms

Thanks,
Venky
Posted

1 solution

Hi,

Solution is easy, implementation a little bit more complicated ^_^...

1 - Use sample project on Dx Sdk to load a mesh or an animated mesh (Panda export for max is not perfect but it work...with the right parameters).
2 - Transform the sample to render it on a texture without FSAA, with for example a purple background.
3 - Access the texture to get a DC on it (to my mind you can do this using Surface
* IDirect3DTexture9 -> GetSurfaceLevel = IDirect3DSurface9.
* IDirect3DSurface9 -> GetDC = HDC
4 - Blit on forms using layered (color key) windows properties.

I do this on 2004 for a job its works but the border of the mesh is sharp.

You may use FSAA and access Z-buf of the render target to extract information to re-build border antialiasing and blit manually to Windows DC, but CPU cost with be higher.

For news OS like Win7, try looking on DXGI it may contain an other solution more friendly use.

I'm in holidays at the end of the day for 7 days, so don't ask me more explication about explication, I switch off my brain and my computer during this period...

Have fun Bye...

Load Anim Mesh : http://www.toymaker.info/Games/html/load_x_hierarchy.html
Render to Texture : http://www.two-kings.de/tutorials/dxgraphics/dxgraphics16.html
Layared Window : http://msdn.microsoft.com/en-us/library/ms997507.aspx
 
Share this answer
 
v2
Comments
Sandeep Mewara 19-May-11 3:11am    
My 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900