C++ – OpenGL 3d stereo viewing for aerial stereo image (left, right images)

openglvisual-c++

My purpose: – display overlapping area with whole left right satellite or aerial image

        - rotate image using roll, pitch yaw angles
        -image format is Tiff image

Now i'm doing OpengGL 3d stereo viewing for aerial stereo image (left, right stereo pair). I displayed my left right image using following code:

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);

now i need to 3D rotate my right image using Opengl following function:
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); but i can't rotate my image.

Please help me how to rotate my image!!!!!
Also i wanna to display left overlapped whole images of same part of left right images with 3d rotating. I don't know how to calculate overlapping regions coordinate of whole left right images. sorry for my poor english.

Best Solution

Pixels read or written using glDrawPixels() are not transformed by the model view matrix, which is what the glRotatef() changes. They are pixels, a more low-level primitive than actual models.

To solve this, consider drawing your content using e.g. a texture-mapped primitive such as a quad.

Related Question