Announcement

Collapse
No announcement yet.

Vertex Coordinates

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Vertex Coordinates

    When reading an STL model from a file, I can extract the bounding box of the untransformed object, useful when adjusting the object to fit within the window.

    But OpenGL itself doesn’t seem to have a way to get the coordinates of all vertices, particularly after transformations. Can that be right? Or, did I just miss the option?

    That seems like such a fundamental piece of information that I was surprised not to find the feature.

    I'm additionally surprised that there is not a simple OpenGL statement that returns coordinates of the bounding box.

  • #2
    See if post #6 of the following thread is useful to you:

    https://www.opengl.org/discussion_bo...ormed-Geometry
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Howdy, Jose!
      The post tells me how to get the transformed location of any point in the scene world - not just the location of vertices found on the objects in the scene.

      Is that right?

      I knew of the glGetFloatv() function but I didn't understand how that could give me the coordinates I was looking for.

      I think I had in mind getting an array of all model vertices, containing the vertices xyz coordinates. What you've pointed out to me is a more global solution to finding transformed vertex positions, regardless of whether the vertex is on a model or not.

      Thanks!

      Comment


      • #4
        And, Jose,
        It would seem that same approach could also be used to get the un-transformed coordinates, provided I use it before transformations are applied. That would be one way of testing the results - putting in a known set of coordinates and seeing what the equations return.

        Comment


        • #5
          Gary,

          I'm not clear on what your "end game" need is, but have you looked at gluUnproject / gluProject?
          "Show me a young Conservative and I'll show you someone with no heart. Show me an old Liberal and I'll show you someone with no brains." ― Winston Churchill
          "Socialism is the philosophy of failure, the creed of ignorance and the gospel of envy." ― Winston Churchill

          Comment


          • #6
            Hey Doug,
            ... the bounding box of the untransformed object
            I just wondered it there was a way in OpenGL to get the bounding box of all objects in a scene - the max/min xyz values when considering all vertices.

            As I mentioned, when I read the data from a file, I can do it myself. But I would have guessed that OpenGL could do it too, including the coordinates of transformed vertices.

            Looking at the glProject/gluProject documentation, I'm not sure how that would help in this situation.

            Comment

            Working...
            X