title: Developing for Retina and non-retina displays OpenGL ES
body: <p>I am looking for advice before getting too deep into my next project.  I would like to support all the various resolutions now supporting by iOS (retina, non-retina iPhones, and all 3 iPads).  </p>
  
  <p>What is the most common way developers are getting this done?  I have seen similar questions asked but on a specific nature.  I am looking for the complete package.  IE.  I would like to support different resolution bitmap fonts, images, etc.</p>
  
  <p>Is the device specific switch, or if statements standard?</p>
  
  <p>Thanks for all the help in advanced.</p>
  
  <p>E</p>
  
  <p>Edit:  I have found this from Apple:</p>
  
  <blockquote>
    <p>Blockquote
    If your application uses OpenGL ES for rendering, your existing drawing code should continue to work without any changes. When drawn on a high-resolution screen, though, your content is scaled accordingly and will appear more blocky. The reason for the blocky appearance is that the default behavior of the CAEAGLLayer class, which you use to back your OpenGL ES renderbuffers , is the same as other Core Animation layer objects. In other words, its scale factor is set to 1.0 initially, which causes the Core Animation compositor to scale the contents of the layer on high-resolution screens. To avoid this blocky appearance, you need to increase the size of your OpenGL ES renderbuffers to match the size of the screen. (With more pixels, you can then increase the amount of detail you provide for your content.) Because adding more pixels to your renderbuffers has performance implications, though, you must explicitly opt in to support high-resolution screens.</p>
    
    <p>Blockquote
    To enable high-resolution drawing, you must change the scale factor of the view you use to present your OpenGL ES content. Changing the contentScaleFactor property of your view from 1.0 to 2.0 triggers a matching change to the scale factor of the underlying CAEAGLLayer object. The renderbufferStorage:fromDrawable: method, which you use to bind the layer object to your renderbuffers, calculates the size of the renderbuffer by multiplying the layer’s bounds by its scale factor. Thus, doubling the scale factor doubles the width and height of the resulting renderbuffer, giving you more pixels for your content. After that, it is up to you to provide the content for those additional pixels.</p>
  </blockquote>
  
  <p>So I guess my updated question is how do I double the scale factor described above?</p>
  
  <p>Edit 2:</p>
  
  <p>I am almost there...</p>
  
  <p>I am using this to scale inside my EAGLView:</p>
  
  <pre><code>        // Adjust for retina displays
      if ([self respondsToSelector:@selector(setContentScaleFactor:)])
      {
              self.contentScaleFactor = [[UIScreen mainScreen] scale];
      }
  </code></pre>
  
  <p>The only problem that now remains is the origin is somehow messed up.  Display images now scale according to the resolution, but on the larger resolution the image starts in the middle of the screen.</p>
  
  <p>Please help!</p>
  
  <p>Edit 3: Solved!!!!  I was experiencing the problems in my orientation.</p>
  
  <p>You need to make sure your translate is updated.  I used this:</p>
  
  <pre><code>    glTranslatef( width / 2, height /2, 0);
  glRotatef(-90, 0, 0, 1);
  glTranslatef(-1 * (height / 2),-1 * (width / 2),0);
  </code></pre>
  
  <p>Thanks for the looks.  I hope this helps someone.</p>