Jump to content
  • Advertisement
Sign in to follow this  
Coluna

OpenGL Using OpgnGL modelview matrix into Direct Sound listener

This topic is 4930 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi; I dont know if its the right place to put this thread, but its more acceptable than posting in Directx forum (since there they should use Direct3d for graphics...). Im trying to set the listeners parameters using the modelview of OpenGL, but as the Z axis is inverted in DirectX, the sound get inverted...Im testing in a 5.1 system, so i can hear clearly when something is wrong...i tried setting every sound position and velocity as the -position.z and -velocity.z, as well as the -camera.position.z..but now the problem is that the modelview seems to be wrong when my X angle is not 0 ...i set up the camera like this glRotatef(ang_x,1,0,0); glRotatef(ang_y,0,1,0); glTranslatef(-position.x,-position.y,-position.z); Now i did this way: cMATRIX matx, maty,mat; matx.RotateX(ang_x); maty.RotateY(ang_y); mat = maty*matx; and im using this matrix to set up the UP and FRONT vectors of my listener, and continue using the inverted Z axis everywhere....but its a bit confusing. Is there another way to setup the listener? Thanks

Share this post


Link to post
Share on other sites
Advertisement
What you have to keep in mind is that DX's matrix is row major where as OpenGL's matrix is column major, so if you need to feed an OpenGL matrix into a DX function you'll need to transpose it from one form to the other (or, iirc there is a function which allows you to readback a transposed matrix from OpenGL)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i have a question why some people use thier own Matrix's calculating and the don't use the stander functios like (glRotate*(),glTranslate*(),glScale*(),gluLookAt(),....etc)

Share this post


Link to post
Share on other sites
i think because the readback from the current modelview matrix is slow. and if you have your own matrix manipulation you don't have to read back!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
is it too slow ???!

Share this post


Link to post
Share on other sites
it can be, however it is still faster to perform alot of the maths yourself and onlu upload the matrix when done as you'll need the matrix for many other operations.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
i have a question why some people use thier own Matrix's calculating and the don't use the stander functios like (glRotate*(),glTranslate*(),glScale*(),gluLookAt(),....etc)

If you have local copy of the calculated matrix, it can be used to quickly extract things like position and local forward/right/up vectors from it, to convert object orientation between local and world spaces, and do other things which are also quite useful. (you avoid having to pull the current matrix out of openGL which from what i understand, can be rather slow)

Also, IIRC openGL functions always post-multiply current matrix, effectively doing transformations in local space, which might not be something you want.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!