Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to render with isometric perspective? [duplicate]

Possible Duplicate:
true isometric projection with opengl

I want to render using the same isometric rendering which Blender3d uses, how can i do this ? Is it possible with just a call to glMultMatrix() ? I tried googling but couldnt find any working matrixes that would result in that kind of rendering mode. i tried this http://en.wikipedia.org/wiki/Isometric_projection but it just rendered really weird.

This is the matrix i use now that renders with normal perspective:

    GLdouble f = cotan(fovy/2.0);
    GLdouble aspect = (GLdouble)width/(GLdouble)height;

    IsoMatrix.x[0] = f/aspect;
    IsoMatrix.y[0] = 0;
    IsoMatrix.z[0] = 0;
    IsoMatrix.w[0] = 0;

    IsoMatrix.x[1] = 0;
    IsoMatrix.y[1] = f;
    IsoMatrix.z[1] = 0;
    IsoMatrix.w[1] = 0;

    IsoMatrix.x[2] = 0;
    IsoMatrix.y[2] = 0;
    IsoMatrix.z[2] = (zfar+znear)/(znear-zfar);
    IsoMatrix.w[2] = (2.0*zfar*znear)/(znear-zfar);

    IsoMatrix.x[3] = 0;
    IsoMatrix.y[3] = 0;
    IsoMatrix.z[3] = -1;
    IsoMatrix.w[3] = 0;

    glMultMatrixd((GLdouble *)&IsoMatrix);

How do i change it so it will result to: http://rvzenteno.files.wordpress.com/2008/10/rvz_018.jpg ?

like image 243
Rookie Avatar asked Feb 02 '23 16:02

Rookie


1 Answers

It is easier to use glOrtho then rotate the axes:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-10.0f, 10.0f, -10.0f, 10.0f, -10.0f, 10.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(35.264f, 1.0f, 0.0f, 0.0f);
glRotatef(-45.0f, 0.0f, 1.0f, 0.0f);
like image 75
Alex Peck Avatar answered Feb 05 '23 18:02

Alex Peck