# How to generate MIP (Maximum Intensity Projection)

Now that I have the 3D Texture mapping working and am able to generate images by passing a plane through the 3D texture map, the next thing I need to do is to figure out how to blend the images together to make a single mip image out of the slices…

This code goes a slice at a time through the 3D texture and produces an image of the slice on the z plane. I need to combine these slices into one slice where the pixel value is the maximum value…

So if I had 16 images then i would look at pixel(0,0,n) where n is the slice number and output a single new pixel at pixel(0,0) of value x where x was the ‘brightest’ pixel.

If I understand glTexGen it does the iterations through the volume for me?

Looking at some of the links dorbie posted on 3D Textures one of them was on MIP

However the EXT functions don’t seem to be known to my version of OpenGL which I believe is 1.4

``````void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

static int slice = 0;
float z;

z = (1.0/((float) (iDepth-1))) * (float) slice;

glTexCoord3f(0.0, 0.0, z); glVertex3f(-1.0, -1.0, 0.0);
glTexCoord3f(1.0, 0.0, z); glVertex3f(-1.0,  1.0, 0.0);
glTexCoord3f(1.0, 1.0, z); glVertex3f( 1.0,  1.0, 0.0);
glTexCoord3f(0.0, 1.0, z); glVertex3f( 1.0, -1.0, 0.0);

glEnd();

glFlush();

slice = (slice+1) % iDepth;
}

``````

hey drbob, minmax was added to the core in version 1.2:
http://www.opengl.org/documentation/spec.html