Sign in to follow this  

Raytracing, where to draw to...

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

Hi all, I'm trying to create a simple raytracer and I am wondering what is the best way to display the image on the screen. I've found a tutorial with sample code on devmaster.net that simply uses the windows GDI. I've also tried to do it with XNA but couldn't find a way to manipulate pixel values of the back buffer directly (I guess I could draw to a texture and map that texture onto a quad that fills the screen, but that seems like a slow way of doing it...). Does know what would be the smartest way of doing this? Maybe using windows GDI is a good way? Thanks, -Michael ps: I am working on windows with using vc 2005

Share this post


Link to post
Share on other sites
There's lots of ways to do this. I prefer the syntax of GDI+ over plain GDI. You could the use Bitmap::SetPixel to set the individual pixel values as you compute them, and then Graphics::DrawImage to display the image.

Share this post


Link to post
Share on other sites
Quote:
Original post by michaweyel
Hi all,

I'm trying to create a simple raytracer and I am wondering what is the best way to display the image on the screen. I've found a tutorial with sample code on devmaster.net that simply uses the windows GDI. I've also tried to do it with XNA but couldn't find a way to manipulate pixel values of the back buffer directly (I guess I could draw to a texture and map that texture onto a quad that fills the screen, but that seems like a slow way of doing it...).

Does know what would be the smartest way of doing this? Maybe using windows GDI is a good way?

Thanks,
-Michael

ps: I am working on windows with using vc 2005


Actually, many use to draw into a texture and then fill a quad with the same size of the screen. This makes also possible to perform some post processing efeect (like glows) directly on hardware.

There isn't really any 'best method' for this task though: everything depends upon what you need. I use SDL because this way I only need very few lines of code to set up a simple viewer, but you may also use GDI (after all, it is nothing else than a bitmap) if you want a 'windows' style for you application.

Unless you target real time ray tracing. In this case you must carefully choose the display step to maximize performanca, and in this case the 'best methods' is perhaps to draw into a texture.

Share this post


Link to post
Share on other sites

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