How to do isometric projection ?

38 views
Skip to first unread message

Skybuck Flying

unread,
May 19, 2022, 7:21:05 AM5/19/22
to pbrt
Hello,

The video game X-Com and OpenXcom uses isometric projection.

Others and me I have partially figured out how to do this in OpenGL, but how to do it in PBRT, opengl method.

The only remaining problem with the OpenGL method below is that the Z axis goes into the screen... while in the game the Z goes up, like the y-axis.

So the Z and Y axis need to be swapped, any help with that would also be appreciated.

In case PBRT requires a camera position, then some translate and rotate example that
mimics this isometric view would also be appreciated ???

Basically I am trying to figure out which parameters to use for the PBRT file:

# eye                                                            
# look at point                                                  
LookAt 200 200 20                                                  
    0 0 0                                                    
    0 0 1  
   
The above parameters should be replaced with something....

procedure TRenderer.EnterIsometricMode;
begin
    with TOpenGLAPIVersion110 do
    begin
        glMatrixMode(GL_PROJECTION);
        glPushMatrix();

        glLoadIdentity();

        begin
            var scale : double := 50;
            glOrtho
            (    -scale,
                scale,
                -scale * 0.7,
                scale * 0.7,
                -scale,
                scale
            );
        end;

        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();

        glLoadIdentity();

        glRotatef(35.264, 1.0, 0.0, 0.0);
        glRotatef(-45.0, 0.0, 1.0, 0.0);
    end;
end;

procedure TRenderer.LeaveIsometricMode;
begin
    with TOpenGLAPIVersion110 do
    begin

        glMatrixMode(GL_MODELVIEW);
        glPopMatrix();

        glMatrixMode(GL_PROJECTION);
        glPopMatrix();
    end;
end;

Bye for now,
  Skybuck.
Reply all
Reply to author
Forward
0 new messages