PDA

View Full Version : need position vectors for OpenAL

Alien999999999
05-29-2004, 05:06 AM
for our project, someone is implementing OpenAL to combine with OpenGL, but alas, the source and listener need a vector position.

but I'm working with matrix mult for positions, is there a way to get the position (and orientation) vector; or do i have to get the current transformation matrix and try to get the position and orientation (or normal) out that way?

if i have to get it through the transformation vector can someone tell me how such a thing is accomplished?

I had tried GL_CURRENT_RASTER_POSITION and GL_CURRENT_NORMAL, but that seemed not to be the way.

ZbuffeR
05-29-2004, 05:28 AM
You can get the transformation matrix at any time with glGetFloatv(GL_MODELVIEW_MATRIX,arrayOf16GLfloats) , then multiply the vector you need with this matrix, and you get the final vector.

Alien999999999
05-29-2004, 05:58 AM
what do you mean multiply with the vector you need.

I'm sorry for my math, i know how to get the transformation matrix, but what vector do I need to multiply with that matrix to get the actual position of the object?

and what about the orientation, the at and up vector?

in OpenAL those are required to get the sound going...

ZbuffeR
05-29-2004, 09:50 AM
In fact for the viewer, the vector will be {0,0,0}.
For the origin of an object too. I mean, if you have a cube centered on 0,0,0 then you do a bunch of glTranslate, glRotate, etc. then get the final modelview matrix, multiply the 0 vector by it, and you end with the world space coordinate.

For the camera position, only the matrix to get is not the same.

I am not good at maths either, but I know google :
http://www.opengl.org/resources/faq/technical/transformations.htm
http://www.wazooenterprises.com/tutorials/tutorial2-OGL.html
http://www.falloutsoftware.com/tutorials/gl/gl5.htm