rendering pixels to a screen, fast

Soldato
Joined
23 May 2005
Posts
2,964
Location
Auckland, New Zealand
I'm writing a real time ray tracer and as you probably know, pixel colour values are calculated individually. I need a way to render these pixels to the screen fast. I've tried windows GDI (updating the pixel values on the back buffer (in a double buffering system) but that is incredibly slow. I've also tried using openGL (storing all pixel values in a buffer, when a frame is rendered, throw all of those values into a texture and texture a quad with that texture) but that was even slower! I dont know how that was slower than windows GDI, maybe I was doing it worng. Any other suggestions?

cheers. Joe
 
I've never tried it - but what about the all-at-once approach using GDI - Is this any use?

Are you breaking barriers in Dundee, BTW? :)
 
Uh lol? You have written a ray tracer (I'm assuming in C++ or C) and you expect it to be lightening fast? How many rays/objects/reflections/lights/levels of antialiasing are you even using? (Those were the top scaling factors I could think off of my head...)
 
I've never tried it - but what about the all-at-once approach using GDI - Is this any use?

Are you breaking barriers in Dundee, BTW? :)

ah yeah good old bit blit. the method I've been using under GDI is just to write to my back buffer as the pixels come in.. I'll give the all at once approach a go.

Pho: yes I probably could but the chances are, I'd pull out all of my hair doing it. Hopefully Ray tracing will fade out the need for those kind of shaders :P

shoeski: no i'm not expcting it to be incredibly fast but I'd really like the method of drawing the pixels to not be the most time consuming operation in my project. right now the SetPixel() function is winning (or loosing) by a long way! I'll be multithreading this engine and hopefully making use of SSE in my math libraries to squeeze a little extra juice. So I am expecting it to run fast enough that screen rendering times are not negligable.

ALSO if I can port it to this thing that Abertay are just setting up now:




(yes that is 6 PS3s) It shoudl run like a dream :)

Oh yes and Abertay IS breaking barriers :p :)
 
Last edited:
GDI should be plenty fast enough if you create an off-screen bitmap with CreateDIBSection and blit it to the window using BitBlt.

I'd use a pointer incremented across the bitmap rather than a generic SetPixel function to eliminate having to calculate memory offsets for each pixel you write the value of.

If you're expecting framerates far faster than realtime then DirectX full screen mode using a back buffer would be almost zero overhead (it doesn't have to blit)
 
Back
Top Bottom