Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

understanding the OpenGL matrix implementation



Greetings,

I'm trying to understand OpenGL's matrix implementation. The spec suggests
m[16] instead of m[i][j]. Seeing that an array starts at 0, are we discarding
m[0] or m[16]?

Also, this is my organizational understand. Please correct me if I'm wrong.

the OpenGL array

a e i m
b f j n
c g k o
d h l p

should translate to (the C convention as the red book suggests)

a b c d
e f g h
i j k l
m n o p

So if I wanted to multiply a vector against my "OpenGL" matrix, it should look
like this?

temp_x = (x * a) + (y * b) + (z * c) + (1 * d);
temp_y = (x * e) + (y * f) + (z * g) + (1 * h);
temp_z = (x * i) + (y * j) + (z * k) + (1 * l);

x = temp_x;
y = temp_y;
z = temp_z;

Is this correct? I'm sorry I stink at math, but I really want to understand
what's happening.

thanks
James




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.