release

11-27-2003, 10:24 PM

I projection vertex thange (x,y,z) to x [0,1] y [0,1] z [0,1] by my myselef like this

x = (x-xmin)/(xmax-xmin);

y = (y-ymin)/(ymax-ymin);

z = (z-zmin)/(zmax-zmin);

glMatrixMode(GL_PROJECTION)

glLoadIdentity();

gluPerspective(90,aspect,1,5)

glMatrixMode(GL_MODELVIEW)

glLoadIdentity();

glTranslated(0,0,-3)

drawScene();

above code does work;

But i let gl projection (x,y,z) to x [0,1] y [0,1] z [0,1] code like this

glMatrixMode(GL_PROJECTION)

glLoadIdentity();

gluPerspective(90,aspect,1,5)

glMatrixMode(GL_MODELVIEW)

glLoadIdentity();

glTranslated(-xMin,-yMin,-zMin)

glScaled(1.0f/(xMax-xMin),1.0f/(yMax-yMin),1.0f/(zMax-zMin)

glTranslated(0,0,-3)

drawScene();

it does not work as i like.Somebody help me!

x = (x-xmin)/(xmax-xmin);

y = (y-ymin)/(ymax-ymin);

z = (z-zmin)/(zmax-zmin);

glMatrixMode(GL_PROJECTION)

glLoadIdentity();

gluPerspective(90,aspect,1,5)

glMatrixMode(GL_MODELVIEW)

glLoadIdentity();

glTranslated(0,0,-3)

drawScene();

above code does work;

But i let gl projection (x,y,z) to x [0,1] y [0,1] z [0,1] code like this

glMatrixMode(GL_PROJECTION)

glLoadIdentity();

gluPerspective(90,aspect,1,5)

glMatrixMode(GL_MODELVIEW)

glLoadIdentity();

glTranslated(-xMin,-yMin,-zMin)

glScaled(1.0f/(xMax-xMin),1.0f/(yMax-yMin),1.0f/(zMax-zMin)

glTranslated(0,0,-3)

drawScene();

it does not work as i like.Somebody help me!