我的目的: - 显示与整个左右卫星或航拍图像重叠的区域
- rotate image using roll, pitch yaw angles
-image format is Tiff image
现在我正在对航空立体图像(左、右立体对)进行 OpenGL 3d 立体观看。我使用以下代码显示了左右图像:
glDrawBuffer (GL_BACK_LEFT);
LeftBuf = new unsigned char [LeftCol * LeftRow *3];
for (int i = 0; i < LeftRow; i++){
for (int j = 0; j< LeftCol; j++){
LeftBuf [(i*LeftCol + j)*3] = tiff.LnBuf [i*LeftCol + LeftCol-(j-1)];
LeftBuf [(i*LeftCol + j)*3+1] = tiff.LnBuf [i*LeftCol + LeftCol-(j-1)];
LeftBuf [(i*LeftCol + j)*3+2] = tiff.LnBuf [i*LeftCol + LeftCol-(j-1)];
}
}
glRasterPos2f(-1,-1);
glDrawPixels(LeftCol, LeftRow, GL_RGB, GL_UNSIGNED_BYTE, LeftBuf);
glDrawBuffer (GL_BACK_RIGHT);
RightBuf = new unsigned char [RightCol *RightRow *3];
for (int r = 0; r < RightRow; r++){
for (int c = 0; c< RightCol; c++){
RightBuf [(r*RightCol + c)*3] = tiff.RnBuf [r*RightCol + RightCol-(c-1)];
RightBuf [(r*RightCol + c)*3+1] = tiff.RnBuf [r*RightCol + RightCol-(c-1)];
RightBuf [(r*RightCol + c)*3+2] = tiff.RnBuf [r*RightCol + RightCol-(c-1)];
}
}
glRasterPos2f(-1,-0.45);
glDrawPixels(RightCol, RightRow, GL_RGB, GL_UNSIGNED_BYTE, RightBuf);
现在我需要使用 Opengl 以下函数 3D 旋转我的右图像: glRotatef(rightphoto.omega*180/PI,1.0f,0.0f,0.0f); glRotatef(rightphoto.phi*180/PI,0.0f,1.0f,0.0f); glRotatef(rightphoto.kappa*180/PI,0.0f,0.0f,1.0f);但我无法旋转我的图像。
请帮我如何旋转我的图像!!!! 我还想通过 3D 旋转显示左右图像相同部分的左重叠整个图像。我不知道如何计算整个左右图像的重叠区域坐标。抱歉我的英语不好。
最佳答案
使用glDrawPixels()
读取或写入的像素不会被模型 View 矩阵转换,这是glRotatef()
所改变的。它们是像素,是比实际模型更底层的基元。
要解决此问题,请考虑使用例如绘制内容纹理映射基元,例如四边形。
关于visual-c++ - OpenGL 3d 立体观看航空立体图像(左、右图像),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/323053/