Reputation: 441
The example that XCode generates for an OpenGL ES App, creates a square using the following coordinates:
static const GLfloat squareVertices[] = {
-0.5f, -0.33f,
0.5f, -0.33f,
-0.5f, 0.33f,
0.5f, 0.33f,
};
How does this generate a square when the sides are clearly of unequal length? Has the scaling been set up in some odd way, or is it to do with the screen size? How do I set things so that specifying equal sides will get me a square and not a rectangle?
Upvotes: 0
Views: 188
Reputation: 2672
By default the viewport is set for both axis of the screen to range from -1 to +1. You need to change the viewport depending on the size of your view using:
void glViewport( GLint x, GLint y, GLsizei width, GLsizei height);
Upvotes: 1