• Advertisement
Sign in to follow this  

Best way to draw ray tracing image to screen?

This topic is 1867 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 everyone,

I am learning ray tracing and there is a very good tutorial here:
http://www.codermind.com/articles/Raytracer-in-C++-Introduction-What-is-ray-tracing.html

But the problem is that it doesn't display image to the screen, instead it creates a texture image which can not be viewed.

I need a way to display to the screen in real time, I don't know about image format, so I want to ask what is the simplest way to display 2D array of pixels to screen? I want to use 2D array because I want to edit each pixel

Regards

Share this post


Link to post
Share on other sites
Advertisement
Based on that tutorial I presume you are using C++.
You need to use any of the zillion drawing libraries that are available.
I'd go with SFML. After you have the library set up on your computer, look here for how to initialize a SFML image with your own pixel array and draw:
http://en.sfml-dev.org/forums/index.php?topic=3543.0

Share this post


Link to post
Share on other sites
Thank you all, I will try.

Well, and I don't mind complicated thing if it is fast. And so, I would want to ask, normally what solution you guys or commercial ray tracing software use to display image? I know that ray tracing is slow but a fast display method is always preferred

Regards

Share this post


Link to post
Share on other sites
[quote name='313230' timestamp='1355157520' post='5009115']
I know that ray tracing is slow but a fast display method is always preferred[/quote]
Ray tracing is so slow, that any method will work. Pixel toaster will happily push 60 fps images to the screen, if you can fill them that fast. (as will pretty much any other windowing toolkit: SFML, SDL, your own OpenGl context...)

Share this post


Link to post
Share on other sites
[quote name='swiftcoder' timestamp='1355153097' post='5009089']
Those are both arbitrarily complicated options. Look at [url="http://code.google.com/p/pixeltoaster/"]Pixel Toaster[/url], instead.
[/quote]Eh, all of them are piss easy to get started with. Pixel Toaster doesn't have much advantage there.

His raytracer may not need more from the framework/library than the ability to tweak single pixels, but being able to easily draw primitives, render text, etc. could be a big boon for various kinds of debugging, creating live previews, etc. Just yesterday I finished building a small raytracer for a school assignment, and I could definitely have used all of that stuff. I think 80% of my time went to tracking down bugs. Edited by Stroppy Katamari

Share this post


Link to post
Share on other sites
Yeah, it is worth learning and using some ray tracing, but be careful about major performance decline with it which is very challenging to avoid.


Clinton

Share this post


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

  • Advertisement