Jump to content
  • Advertisement
Sign in to follow this  
Ixusv4

[.net] Running DirectX in a seperate thread in VB.net

This topic is 3793 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

I can do DirectX in an picturebox on a form in VB.net.. Only problem is when I put a slider or anything else on the form for example adjust the speed of something..the rendering halts..Is there a way to run DirectX in a seperate thread so that the rendering loop will continu when I do something else on a form?

Share this post


Link to post
Share on other sites
Advertisement
You don't need to run directx in a different thread to do this. How are you handling the forms events, and when is the rendering occurring?

For that matter, I'm not sure directx would even appreciate being in a different thread from the form it's being rendered to.

Share this post


Link to post
Share on other sites
The rendering is currently done in a class. In the future I would like to make a DLL with these classes. The rendering is done in loop wich fires every 40 miliseconds...

The program on this stage is an MDI with a form wich shows the actual render...Another form is a control form with several sliders on it to control the movement of the object..Once I slide a slider...the rendering is halted...

Are there any examples wich can help me with the current problem..

Share this post


Link to post
Share on other sites
I don't have any specific examples, but I've done it before.

Instead of handing event handling over to application.run, and doing the rendering on a timed basis, use application.doevents instead.

Something like the following (c#, but you get the idea):

while(someForm.Created)
{
// Render to picture box
Application.DoEvents();
}

Share this post


Link to post
Share on other sites
I'm confused. Rendering halts when you add the scrollbar/objects or when the user interects with the scrollbar/object?

If it's interaction, then yes running it on another thread will solve the problem. But before I gurantee that 100%, answer the above question ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by gharen2
I don't have any specific examples, but I've done it before.

Instead of handing event handling over to application.run, and doing the rendering on a timed basis, use application.doevents instead.

Something like the following (c#, but you get the idea):

while(someForm.Created)
{
// Render to picture box
Application.DoEvents();
}

Bad Code!

Better code! [grin]

Share this post


Link to post
Share on other sites
Yeah yeah yeah.

I didn't want to complicate things further by going into that. I figure, once he gets it working with Application.DoEvents, he can look at optimizing it. Implement first, optimize second, they always say :)

Share this post


Link to post
Share on other sites
The DOEvents was already implanted in my renderloop. If it wasn't there any interaction with other controls on any form in the same program would be impossible.

The problem arises when the user interacts with the scrollbar/object or any object or when one moves any form around..

The problem is in the fact dat VB.net is not multi-tasking. And usually one makes a directX program Fullscreen...Buth I want to make my own 3D Editor :(

Share this post


Link to post
Share on other sites
Quote:
Original post by gharen2
Yeah yeah yeah.

I didn't want to complicate things further by going into that. I figure, once he gets it working with Application.DoEvents, he can look at optimizing it. Implement first, optimize second, they always say :)


Yeah, but implement the best way you know how. :)

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.

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

Sign me up!