3D positions

Discussion in 'C++' started by Mike, Jun 19, 2010.

  1. Mike

    Mike Guest

    Hi
    I try to move openal sound positions with an airplane in C++. I saw
    (below) that I could draw in opengl but i wonder how I could use this
    for my sound positions?
    Many thanks
    Michael


    openal listener using this float value:
    sim/graphics/view/view_x
    etc.

    aircraft sound positions use those float values:
    sim/flightmodel/position/local_x
    lX = local_x etc.
    SourcesPos[1][0] = (lX/100)-pTheta;//pitch
    SourcesPos[1][1] = (lY/100)+(heading/100);
    SourcesPos[1][2] = (lZ/100)+pPhi;//roll

    --------------------

    A given aircraft in X-Plane can be thought to have its own coordinate
    system with the same units (meters) as world coordinate systems, but
    positioned differently:

    * The origin is at the default center of gravity for the aircraft.
    * The X axis points to the right side of the aircraft.
    * The Y axis points up.
    * The Z axis points to the tail of the aircraft.

    You can draw in aircraft coordinates using these OpenGL
    transformations:

    glTranslatef(local_x, local_y, local_z);
    glRotatef (-heading, 0.0,1.0,0.0);
    glRotatef (-pitch,-1.0,0.0,0.0);
    glRotatef (-roll, 0.0,0.0,1.0);

    where local_x, local_y, and local_z is the plane's location in
    "local" (OpenGL) coordinates, and pitch, heading, and roll are the
    Euler angles for the plane. Be sure to use glPushMtarix and
    glPopMatrix to restore the coordinate system.
    Mike, Jun 19, 2010
    #1
    1. Advertising

  2. Am Sat, 19 Jun 2010 05:13:04 -0700 (PDT)
    schrieb Mike <>:

    > Hi
    > I try to move openal sound positions with an airplane in C++. I saw
    > (below) that I could draw in opengl but i wonder how I could use this
    > for my sound positions?
    > Many thanks
    > Michael


    First of all: OpenAL is not related to OpenGL in direct "bloodline".
    The API design deliberately follows OpenGL. However OpenAL is not
    discussed on this NG: Completely different library/API, not related to
    graphics, but sound.

    > [snip]


    Before drawing the plane, X-Plane transforms your modelview matrix
    so, that all further incoming coordinates are relative to the coordinate
    frame defined by the aircraft, i.e. Z axis along the fuselage, X
    parallel to the wings.

    So independent if you're in cockpit view mode, or follower, or
    something else, the geometry and transformations sent to drawing
    commands stay the same.

    Similar with OpenAL, only instead of transforming drawn geometry you're
    moving sound sources. And just like in OpenGL in OpenAL the listener
    always is in the origin.

    So what you do is: For every matrix manipulation done in OpenGL do the
    very same thing with OpenAL. Position your sound sources at the same
    location, where the geometry, which shall visualize the sound source is
    placed.

    OpenAL brings a few nice examples of how to combine OpenGL and OpenAL.
    I suggest you have a look at them.


    Wolfgang
    --
    CIP-Rechnerbetriebsgruppe
    Fakultät für Physik - LMU München
    Schellingstrasse 4, 80799 München
    Wolfgang.Draxinger, Jun 22, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. .Net recruiter

    ASP.Net developer positions

    .Net recruiter, Dec 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    525
    .Net recruiter
    Dec 30, 2003
  2. Recruit Interns

    Verification Intern Positions Available

    Recruit Interns, Aug 14, 2003, in forum: VHDL
    Replies:
    0
    Views:
    1,205
    Recruit Interns
    Aug 14, 2003
  3. The job lady
    Replies:
    0
    Views:
    543
    The job lady
    Jan 13, 2006
  4. =?Utf-8?B?SklNLkgu?=

    object positions

    =?Utf-8?B?SklNLkgu?=, Aug 21, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    360
    David Jessee
    Aug 23, 2004
  5. Knut Krueger
    Replies:
    2
    Views:
    431
    Knut Krueger
    May 21, 2007
Loading...

Share This Page