void textureProjection(Matrix4x4f &mv) { Matrix4x4f inverseMV = Matrix4x4f::invertMatrix(mv); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glTranslatef(0.5f,0.5f,0.0f); //Bias glScalef(0.5f,0.5f,1.0f); //Scale glFrustum(-0.035,0.035,-0.035,0.035,0.1,1.9); //MV for light map glTranslatef(0.0f,0.0f,-1.0f); glMultMatrixf(inverseMV.getMatrix()); //Inverse ModelView glMatrixMode(GL_MODELVIEW); }
void textureProjection(Matrix4x4f &mv) { Matrix4x4f inverseMV = Matrix4x4f::invertMatrix(mv); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glTranslatef(0.5f,0.5f,0.0f); float wImg = textureImage[textureIndex-1].Width; float hImg = textureImage[textureIndex-1].Height; if (wImg < hImg) { glScalef(1.0f,(1.f*wImg)/hImg,1.0f); } else { glScalef((1.f*hImg)/wImg,1.0f,1.0f); } glFrustum(-0.035,0.035,-0.035,0.035,0.02,2.0); glMultMatrixf(inverseMV.getMatrix()); glMatrixMode(GL_MODELVIEW); }
void textureProjection(Matrix4x4f &mv) { Matrix4x4f inverseMV = Matrix4x4f::invertMatrix(mv); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glTranslatef(0.5f,0.5f,0.0f);//Bias float wImg = textureW[textureIndex-1]; float hImg = textureH[textureIndex-1]; if (wImg < hImg) { glScalef(1.0f,(1.f*wImg)/hImg,1.0f);//Scale } else { glScalef((1.f*hImg)/wImg,1.0f,1.0f);//Scale } glFrustum(-0.035,0.035,-0.035,0.035,0.02,2.0);//MV for light map //glTranslatef(0.0f,0.0f,-1.0f); glMultMatrixf(inverseMV.getMatrix());//Inverse ModelView glMatrixMode(GL_MODELVIEW); }