Hi guys

I implementing the ray casting algorithm but I have a great trouble.

My basic idea was,

At CPU
1.Compute the nearest vertex of bounding box and the farthest vertex for determine the maximum distance for the ray traversal.
2.Send the Min and Man values

At GPU
1.In the shader, I am recovering the position the camera, then I calculate the ray direction as

vec3 dir= camera.xyz – gl_TexCoord[0].xyz;

and advance a positon along the ray.

2.Composite the final color


My problem is how to rendering the plane of image, I do as,

glBegin(GL_QUADS);

glTexCoord2f(0.0, 0.0 );
glVertex2f(-1.0, -1.0);
glTexCoord2f(1.0, 0.0 );
glVertex2f(1.0, -1.0);
glTexCoord2f(1.0, 1.0 );
glVertex2f(1.0, 1.0);
glTexCoord2f(0.0, 1.0, );
glVertex2f(-1.0, 1.0) ;
glEnd();

- My view port is 512x512

but noting see a image, and how to rendering if the case will be a endoscopy, by ex. (the near plane) ?


Thanks