Question

I'm started to learn a OpenGLES and currently I'm reading this TUTORIAL

I have reached paragraph Adding a Projection and I'm stuck there:

// Add to render, right before the call to glViewport
CC3GLMatrix *projection = [CC3GLMatrix matrix];
float h = 4.0f * self.frame.size.height / self.frame.size.width;
[projection populateFromFrustumLeft:-2 andRight:2 andBottom:-h/2 andTop:h/2 andNear:4 andFar:10];
glUniformMatrix4fv(_projectionUniform, 1, 0, projection.glMatrix);

// Modify vertices so they are within projection near/far planes
const Vertex Vertices[] = {
    {{1, -1, -7}, {1, 0, 0, 1}},
    {{1, 1, -7}, {0, 1, 0, 1}},
    {{-1, 1, -7}, {0, 0, 1, 1}},
    {{-1, -1, -7}, {0, 0, 0, 1}}
};

The author uses some variables in populateFromFrustumLeft... and doesn't explain them. I want to understand the logic of variable selection to be able to use this function in future.

Help me plz to understan the logic!

Was it helpful?

Solution

I have found a very clear explanation!

Watch this tutorial and you'll see the answer at 18:00

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top