Take the 2-minute tour ×

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?

share|improve this question
add comment

1 Answer

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:

share|improve this answer
add comment

Your Answer


