Hey I'm not alone !
Your algorithm won't scale well, you've avoided the complexity of raytracing by limiting the number of objects of the scene... but it's a good start.
I wish you to find some nice tricks of optimization, to be able to draw a more complex scene...
here are some :
- first pass rendering in opengl : one color for each primitive : avoids you the cost of finding the initial ray intersection, use standard GL speedups (bsp...)
- skip pixels to find intersecting objects and go back when they change (works if your primitives are big enough)
- limit field of view (don't scan primitives too far away)
- space partitioning (divide space in cubes, affect primitives to one or more cubes, and have the ray walk through the cubes) : much much harder but some examples can be found on the web (i haven't published my version... which is far from perfect and unreadable)
I'll update bubbleracer
one day with those two tricks (which are in another raytrace engine of mine).
Good luck !