Sign in to follow this  

c# async drawing

This topic is 4662 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 decided I was going to experiment in c# with making a raytracer. So I write my class structure for my rendering engine my lightsources etc etc All my code is working fine. All my small tests for each piece is working nicely. check. happy days! So to make it easier to check each new feature as I add it I decided to create a UI framework to work with to easily test. I created a nice menu for loading/unloading test scenes, a nice menu for starting/stoping/pausing rendering, and finally three tabbed windows one to display the scene file another to display the image as it is rendering and finally a tab with a tree display to show each object and its values. So far so good. So I create a thread to render on and find i am constantly getting a race condition with my picture box with the rendering on it. so i tried to use lockign and it seemed to work but i keep getting wierd bugs with it. so I tried this article on called 'Draw Asynchronously With .NET' http://www.fawcette.com/vsm/2002_08/magazine/columns/desktopdeveloper/ yay! problem solved...um no. all this 'should' work for me but I can't make heads or tails of this gobble gook! I read the article figuring ah all this seems easy so then i tried to implement the code as it is written. well he uses some functions in his example that he doesn't explain very well (at all) the functions work as he describes them but 'how' they do what they do is not explained at all example: Kill(_thread); // ah kills the thread! glory easy peasy yes? when you look at the kill method though it is a ton of gobbled lock unlock join wait etc etc that makes no sense has no comments and even better...no formatting >.< anyone have a good article on threading in C#? a good article on drawing using GDI+ in C#? I HAVE seen an article on raytracing in C# (I have this part down pat no worries there, graphics section of this site was VERY helpfull), unfortunatly this program was not multithreaded. =-( if you would like to see my render engine program as it is i can post it on my web site somewhere but as it is not really worth it. soem times works great some times um yah hehe.

Share this post


Link to post
Share on other sites

This topic is 4662 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.

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