Jump to content
  • Advertisement
Sign in to follow this  

Simple 3D view in a C# form

This topic is 2977 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 :)

Ive been looking for a way to have a simple 3d model (obj, 3ds or dea) with texture spin inside a form.
I have seen plenty of ways to use C# to do this, the only problem is that they create their own window.
Now i wanted to have a form with buttons and lists. When i select a item in the list control, a model should load into the 3d control.
The only problem with this is the 3d control itself as i cannot seem to find a way how to integrate it into my form :(
i have tried SlimDX and Axiom and they both kinda fail (not the engines itself, but the documentation seem to be a bit outdated so the examples don't work)
I also rather not use WPF for this as i'm still building some experience with it (it's different enough that i stick to WinForms for this project)

The 3d window shouldn't do much. Display a model, perhaps with a background (or not) and spin around.
Maybe some buttons so the user can spin the model itself. But that shouldn't be a problem, displaying it is :<

Sorry for the wall of text :) wanted to give you as much information as i could.
Now, is anyone able and willing to give me a hand? :)

Share this post

Link to post
Share on other sites
What do you mean they "create their own window"? You'll have to create your own window/form if you want to do anything. :)

If you want to use SlimDX, then you could very easily add a panel to your main form, and use the panel's handle when you create your SwapChainDescription before you call Device.CreateWithSwapChain(...). Then whatever you draw will be output to the panel instead of the form's background, and you can have any sort of menus or buttons you want around it. You can actually put a button or something right on top of the panel you render to, though I don't recommend it.

The samples that come with SlimDX DO work. If you don't have the June 2010 SlimDX SDK, then go get it from SlimDX.org. Trust me, they work just fine. Take the example code and refactor it to use your own custom form instead of the SlimDX.Windows.RenderForm. It's very simple stuff!

EDIT NOTE: The SlimDX class "RenderForm" actually inherits from System.Windows.Form, fyi. So of course, it's implicitly convertible and you can work with the RenderForm in the designer to add controls if you like.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!