Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Depth output from another POV

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    25

    Depth output from another POV

    Hi,

    I want to output depth from a POV at fragments whose coordinates are from another POV.
    In fact, I want to display objects from my camera POV, but for each fragment, I want to render depth from another camera POV.
    Is that possible ?

    [EDIT]

    I will try to explain myself better.
    In fact, I have some object seen from my main POV, the one used to display objects.
    I would like render those objects exactly but from another POV, in order to get depth and some other things.

  2. #2
    Member Regular Contributor
    Join Date
    Jan 2012
    Location
    Germany
    Posts
    302

    Re: Depth output from another POV

    You want the depth at each position visible from camera A relative to another cameras position B?

    If that's what you want, that's possible by projecting the fragments onto the 2. camera in a fragment shader. That's also done for shadowmapping, maybe you want to look up how that's done and if it helps with your problem.

  3. #3
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: Depth output from another POV

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    SetupCamera();
    RenderObjects();

    glClear(GL_DEPTH_BUFFER_BIT); //Clear depth only
    glColorMask(FALSE, FALSE, FALSE, FALSE); //Will disable color writes
    Setup_NEW_Camera_POV();
    RenderObjects();
    glColorMask(TRUE, TRUE, TRUE, TRUE);
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    25

    Re: Depth output from another POV

    In fact, what I need is much more complex than that, and I drop off this idea because of its complexity (F*M*N) in my case, which is far from RT.
    But thanks everyone for your answers, it may help others (or me, another time!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •