Why the clip space in OpenGL has 4 dimensions?

Posted by user827992 on Game Development See other posts from Game Development or by user827992
Published on 2012-08-26T11:32:56Z Indexed on 2012/08/27 21:57 UTC
Read the original article Hit count: 235

Filed under:
|
|

I will use this as a generic reference, but the more i browser online docs and books, the less i understand about this.

const float vertexPositions[] = {
    0.75f, 0.75f, 0.0f, 1.0f,
    0.75f, -0.75f, 0.0f, 1.0f,
    -0.75f, -0.75f, 0.0f, 1.0f,
};

in this online book there is an example about how to draw the first and classic hello world for OpenGL about making a triangle.

The vertex structure for the triangle is declared as stated in the code above.

The book, as all the other sources about this, stress the point that the Clip Space is a 4D structure that is used to basically decide what will be rasterized and rendered to the screen.

Here I have my questions:

  • i can't imagine something in 4D, i don't think that a human can do that, what is a 4D for this Clip space ?
  • the most human-readable doc that i have read speaks about a camera, which is just an abstraction over the clipping concept, and i get that, the problem is, why not using the concept of a camera in the first place which is a more familiar 3D structure? The only problem with the concept of a camera is that you need to define the prospective in other way and so you basically have to add another statement about what kind of camera you wish to have.
  • How i'm supposed to read this 0.75f, 0.75f, 0.0f, 1.0f ? All i get is that they are all float values and i get the meaning of the first 3 values, what does it mean the last one?

© Game Development or respective owner

Related posts about opengl

Related posts about camera