Results 1 to 6 of 6

Thread: GL ES 2.0: which clip coord. after Vertex Shader?

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    5

    GL ES 2.0: which clip coord. after Vertex Shader?

    Hello, I'm reading OpenGL ES 2.0 Programming Guide and have a question regarding clip coordinates as mentioned in the subject here: according to Figure 7.7 the Vertex Shader receives Object Coordinates and shall output clip coordinates. I understand object coordinates to be my own personal coordinates however I define them and I now need to output clip coordinates for the next step in the pipeline. My object coordinates are cartesian coordinates with the camera lens being in the origin. The screen plane is at y=-h (righthanded ocs). How do the Clip coordinates have to Look like for an object vertice at x,y,z ? I searched but didn't find a definitive answer. Thanks.

  2. #2
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    5

    Re: GL ES 2.0: which clip coord. after Vertex Shader?

    I try to make the question more clear.

    How does a Clip Coordinate look like for a traditional cartesian coordinate?

  3. #3
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896

    Re: GL ES 2.0: which clip coord. after Vertex Shader?

    Clip coordinates are what you get after applying modelview and projection matrix (before perspective division):

    Code :
    p_clip = M_proj * M_mv * p_obj

    where p_clip is a point in clip coordinates, M_proj is the projection matrix, M_mv is the modelview matrix and p_obj is a point in object coordinates.

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    5

    Re: GL ES 2.0: which clip coord. after Vertex Shader?

    Thank you. Unfortunately the only results from googling opengl modelview matrix appearing to fit (OpenGL FAQs) are unspecific. I figured I have to deliver clip coordinates as output from the Vertex Shader. As I do the transform in the VS (no fixed-function) I can use any input coordinates as long as I deliver Clip coordinates of these input coordinates.

    I still don't know how a cartesian coordinate (R^3) should look like as a clip coordinate.

    How does the required clip coordinate space look like in R^3?

    Thanks!

  5. #5
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896

    Re: GL ES 2.0: which clip coord. after Vertex Shader?

    Hmm, FAQ 9.011 does not help?

    Clip coordinates are a homogeneous coordinate system (x,y,z,w) so that it is possible to express a perspective projection with a 4x4 matrix and division by w.
    Other than that they don't "look" special in any way, it's just 4 values expressing a position in a left handed (usually orthogonal) homogeneous coordinate system - at least I think it is already left handed, at some point the z-axis is flipped around and I think the projection matrix already does it.

    Ultimately it's just the two matrices applied to your input coordinates. If you are unclear about what kind of transformations are expressed with these two matrices I'd suggest working through a tutorial that explains how these transforms are usually used, e.g. chapters 3&4 of http://www.arcsynthesis.org/gltut.

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    5

    Re: GL ES 2.0: which clip coord. after Vertex Shader?

    Hi, that FAQ didn't help. I read I.1.Following the Data.Vertex Transfer of your link though. This helped. To answer my question: cartesian coordinates + 4th component 1.0 are Clip coordinates already (pending axis mapping). Reading Wikipedia about homogenous coordinates got me the impression h.c. might be non-orthogonal radial inside a pyramidal frustrum. Thank you.

Similar Threads

  1. Convert to HLSL clip-space as a last step in vertex shader?
    By michagl in forum OpenGL: Advanced Coding
    Replies: 14
    Last Post: 09-12-2012, 04:02 PM
  2. Tex coord shifting with fractional vertex pos.
    By trs79 in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 11-04-2011, 10:43 PM
  3. Vertex Coord
    By Agostino in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-01-2008, 10:11 AM
  4. Replies: 1
    Last Post: 09-14-2004, 12:15 PM
  5. a 3d vertex fed in GL, how do you get screen 2d coord?
    By Schlogenburg in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-10-2000, 07:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean