2

我的目的: - 显示与整个左右卫星或航空图像重叠的区域

        - 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 旋转显示左右图像相同部分的左侧重叠的整个图像。我不知道如何计算整个左右图像的重叠区域坐标。对不起我糟糕的英语。

4

1 回答 1

4

使用读取或写入的像素glDrawPixels()不会被模型视图矩阵转换,这就是glRotatef()变化。它们是像素,是比实际模型更底层的基元。

要解决这个问题,请考虑使用纹理映射图元(例如四边形)来绘制您的内容。

于 2008-11-27T08:36:25.983 回答