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 6 of 6

Thread: Vertices list of a projection

  1. #1
    Newbie Newbie
    Join Date
    Oct 2017
    Posts
    3

    Vertices list of a projection

    Hello,

    I need to do a projection of a 3d object, and get the result as a list of segments.
    Is there a way to get it as we create it for the projection (with glNewList, glBegin, glVertex, glEnd, glEndList,...) ?

    Thanks,
    Bougnat

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,468
    Feedback mode: glRenderMode(GL_FEEDBACK).

    If you can rely upon OpenGL 3 support, there's transform-feedback mode (glBeginTransformFeedback() etc).

    Feeback mode returns complete primitives, and includes the effects of clipping (vertices removed by clipping won't appear in the returned primitive, while vertices introduced by clipping will).

    Transform-feedback mode just returns a list of vertices.

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,152
    CPU: Just do the matrix product (M*V*P) for each vertex on the CPU in your app.
    GPU: Use transform feedback to do effectively the same thing in a vertex shader (M*V*P) but store the transformed vertices in a GL buffer object.

    The first is easier, and ideal if you need the results on the CPU anyway.

  4. #4
    Newbie Newbie
    Join Date
    Oct 2017
    Posts
    3
    Thanks for your answers

    @Dark Photon: Yes I need an easy solution, and I need the result on the CPU. But I'm look for OpenGL to take advantage of the GPU efficiency.

    @GClements: Are the vertices sorted in the list? I mean, if a vertex correspond to an end of a segment, does the next vertex correspond to the other end of the same segment?
    And I saw that Feedback can capture primitive of type GL_POINTS, GL_LINES, or GL_TRIANGLES. But what if we created the input list with the type of GL_POLYGONS?

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,468
    Assuming that you're referring to OpenGL 3+ transform-feedback mode, not the legacy feedback mode:

    Quote Originally Posted by Bougnat View Post
    Are the vertices sorted in the list? I mean, if a vertex correspond to an end of a segment, does the next vertex correspond to the other end of the same segment?
    Yes. The output is in the order the primitives are rendered. Each primitive generates 1 (points), 2 (lines) or 3 (triangles) vertices.

    Quote Originally Posted by Bougnat View Post
    And I saw that Feedback can capture primitive of type GL_POINTS, GL_LINES, or GL_TRIANGLES. But what if we created the input list with the type of GL_POLYGONS?
    Polygons and quads are converted to triangles.

  6. #6
    Newbie Newbie
    Join Date
    Oct 2017
    Posts
    3
    Thanks for your answer.

Posting Permissions

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