Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?
share|improve this question
does this last value is a "normalization factor" ? – user827992 Aug 26 '12 at 12:44
3  
Did you bother to read a little farther in the book? Like, say, chapter 4? Because it explains exactly what the fourth component does. Actually, scratch that; Chapter 1 explains the clip-to-NDC transform in the rasterization section halfway down. – Nicol Bolas Aug 26 '12 at 14:29
1  
@NicolBolas the author gives his explanation in the first chapter and doesn't put any reference for the next chapters, also he pretends to explain what happens next when commenting some c++ code and the problem is that if he doesn't fully explain everything in the 1 chapter do not makes much sense to put what i'm supposed to know in the first place in the chapter number 4, especially if i need this concepts to decode what's inside the 1 chapter. I'm reading this now, and not just 1 time, now i know that i'm supposed to look further for the answer, i will go trough the various chapters. – user827992 Aug 26 '12 at 14:39
You don't need to "decode" anything; it says right there in chapter 1: The W component is divided into the other 3 components. I don't know how it can possibly be clearer, especially when this was stated in the introduction as well. What is put off until chapter 4 is why OpenGL does this. That's held off until later because it is irrelevant to the task at hand. – Nicol Bolas Aug 26 '12 at 14:42
1  
It would still be irrelevant information for the issue at hand (ie: rendering a triangle). You're curious about it, but you don't need to understand why it is the way it is to understand that this is how it works. In learning anything, the first step is to understand what it is. Once you understand what's going on, then a discussion can take place about why it is that way. – Nicol Bolas Aug 26 '12 at 14:52
show 2 more comments

1 Answer

up vote 5 down vote accepted

The magic term is "Homogeneous coordinates" which are used in systems where perspecive is a factor. Check the wiki for an overview, but it's a long course of study to really understand it (which I don't).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.