|
|
Why use a raytracer for single triangles? I think that's pointless. The benefit of a raytracer is that you can use it on a whole scene and get things like shadows relatively easily.
OpenGL, as an immediate-mode API, doesn't know about scenes. It has some state, which can be as limited as the framebuffer, some variables to determine how things should be rendered (the matrices, the shading,...), and enough memory to contain all data for just one primitive. Yes, I know that in practical implementations, you can get better performance by grouping primitives, but in principle enough room for one primitive is enough.
OpenGL calls could be translated to scenes, by buffering all primitives into a scene and then raytracing that scene when some command is given. So you translate the scene internal to the program to simple graphics primitives, then translate those to a scene, and raytrace that. Seems like a waste to me.
Of course, this could fail in some cases. For example, an OpenGL program that draws an infinite amount of random triangles can't work in such a system.
|