View Full Version : GL ES 2.0: which clip coord. after Vertex Shader?
12-29-2011, 08:08 AM
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.
12-30-2011, 01:22 PM
I try to make the question more clear.
How does a Clip Coordinate look like for a traditional cartesian coordinate?
12-30-2011, 02:21 PM
Clip coordinates are what you get after applying modelview and projection matrix (before perspective division):
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.
12-30-2011, 03:28 PM
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?
12-30-2011, 04:18 PM
Hmm, FAQ 9.011 (http://www.opengl.org/resources/faq/technical/transformations.htm) 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.
12-30-2011, 08:19 PM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.