opengl dependent on handed-ness?

Hi,

I’ve flipped the usual righanded coordinatesystem to a lefthanded by inserting an ‘almost’ diagonal matrix between the cameraMatrix and the projectionMatrix, setting the z-component to -1. My code works nicely … except for …
I did try to use glLookAt() with a circulating ‘eye-position’ to get the eqvivalent of a ‘mouse-pole’-functionallity, but it didn’t work though it functions perfectly in a righthanded setup. So, I suspect that there are ‘inner workings’ of openGL that assumes a righthanded coordinatesystem? I’m not the brightest bulp, so I could be wrong, but if I’m not, please suggest where I should thread lightly or how to mitigate.
Fighting for getting this ‘mouse-pole’ functionallity to work I’ve been using the inverse of the cameraRotateMatrix as an aid … but if the ‘inverse’ is also dependent on inner openGL assumptions on ‘handed-ness’ I could just go into deeper trouble.
The inner construction of glLookAt() could be a help, if anyone knows.

kindly Carsten

I hope you mean gluLookAt. The code is here:


void GLAPIENTRY
gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx,
      GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy,
      GLdouble upz)
{
    float forward[3], side[3], up[3];
    GLfloat m[4][4];

    forward[0] = centerx - eyex;
    forward[1] = centery - eyey;
    forward[2] = centerz - eyez;

    up[0] = upx;
    up[1] = upy;
    up[2] = upz;

    normalize(forward);

    /* Side = forward x up */
    cross(forward, up, side);
    normalize(side);

    /* Recompute up as: up = side x forward */
    cross(side, forward, up);

    __gluMakeIdentityf(&m[0][0]);
    m[0][0] = side[0];
    m[1][0] = side[1];
    m[2][0] = side[2];

    m[0][1] = up[0];
    m[1][1] = up[1];
    m[2][1] = up[2];

    m[0][2] = -forward[0];
    m[1][2] = -forward[1];
    m[2][2] = -forward[2];

    glMultMatrixf(&m[0][0]);
    glTranslated(-eyex, -eyey, -eyez);
}

You see that the side vector is forward x up, so the algorithm is indeed right-handed. But what do you want to achieve by changing this?
You could of course refrain from using gluLookAt() and write your own matrix code. There, you could adapt this and it would surely work. You would need to use shaders for that, though (or at least it will be easiest this way).

Hi Brokenmind,
Thanks for taking the time. It’s really nice to have some correct code. I’ve been spending way too much time on it. Anyway, I went home and did something that must be somewhat eqvivalent to the glLookAt (and it’s not GLU !). I’ve been very picky on having input and mouse-action function smoothly, transitionless and in fast response, and it really does now. Maybe having the visual output becomes a small blocker for ‘thinking and understanding’.
I spent my first years on directX … I believe it’s lefthanded. When you enter OpenGL (and C/C++ and every other aspect of openSourse [mingw, Code::blocke etc]) I seem to have needed to cling to something that I wouldn’t have to twist my head around.