PDA

View Full Version : Question: 2D ray tracing in OpenGL...pls help!!



siuchick
02-16-2002, 04:25 AM
Dear all,

I have an algorithm for 2D ray tracing but I don't know how to convert them into codes:-

color Ray(point S, vector D, int depth)
{
point I; /* intersection point */
vector R; /* reflected direction */
vector T; /* transmitted direction */
color Lc; /* local illumination */
color Rc; /* reflected color */
color Tc; /* transmitted color */
color Ac; /* accumulated color */

if (depth > MAXDEPTH) {
Ac := BLACK;
}
else
{ I := nerestIntersectionPoint (S,D);
if (noIntersection(I)) {
Ac := BLACK;
} else {
Lc := LocalIllumination (I);
R := ReflectedDirection (I,D);
Rc := Ray (I,R,depth+1);
T := TransmittedDirection (I,D);
Tc := Ray (I,T, depth+1);
Ac := Combine (Lc, Rc, Tc);
}
} return Ac; }

Bob
02-16-2002, 08:02 AM
You want to convert that code? To what language?

siuchick
02-16-2002, 08:24 AM
Into C++~~


Originally posted by Bob:
You want to convert that code? To what language?