Monday, July 04, 2005

glLines problem solved

Solved the glLines problem.

The problem was the line not being displayed for any z-value other than 0.0 because the 2d texture (itself->image->rgb) was being was being rendered above it.

Changing the value of z to 1.o from 0.0 in glVertex3f(,,) i.e. pushing the texture down to the base of the volume gave the lines for all values of z between 0.0 and 1.0

glBegin(GL_QUADS)
glTexCoord2d(0,0); glVertex3f(0,0,1);
glTexCoord2d(0,0); glVertex3f(0,512,1);
glTexCoord2d(0,0); glVertex3f(512,512,1);
glTexCoord2d(0,0); glVertex3f(512,0,0);
glEnd();

Again proceeding in the direction of drawing glLines to render the centerline.

Tried changing the color of internal 2d texture before mapping onto the widget (turned all pixels to green) and it worked. But rendering continuous centerline is certainly more complex.

So now I have to find the corresponding pixel in the 2d texture for a certain centerline position using the equations described in
volume_ray_casting(vrptrT itself, int start_x, int start_y, int width, int height, unsigned int *depth)
and the screen coordinate can be formed from the index of the rgbptr in itself->image->rgb ( lies between ([0,512],[0,512]) ) .

Then use glLines to join the points detected in that particular view.

0 Comments:

Post a Comment

<< Home