Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8412507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:41:11+00:00 2026-06-10T00:41:11+00:00

Im using opengl es 1.1 for the iPhone. I originally wrote everything for portrait

  • 0

Im using opengl es 1.1 for the iPhone.

I originally wrote everything for portrait which looked great but when I switch to landscape mode the graphics appear to be stretched…

Any clues on how to un-stretch this?

Im basically following this tutorial but have added squares and added the shouldAutorotateToInterfaceOrientation but the graphics are still stretched:
http://www.71squared.com/2011/03/tutorial-14-moving-to-3d/

Code:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); 
}

- (void)drawFrame
{
    [(EAGLView *)self.view setFramebuffer];

    // Replace the implementation of this method to do your own custom drawing.
    static const GLfloat squareVertices[] = {
        -0.33f, -0.33f, 0.0f,
        0.33f, -0.33f, 0.0f,
        -0.33f,  0.33f, 0.0f,
        0.33f,  0.33f, 0.0f
    };

    static const GLubyte squareColors[] = {
        255, 255,   0, 255,
        0,   255, 255, 255,
        0,     0,   0,   0,
        255,   0, 255, 255,
    };

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    // Position the camera back from the origin and slightly raised i.e. {0, 3, -6}
    static GLfloat z = 0;

    gluLookAt(0, 5, -10, 0, 0, 0, 0, 1, 0);
    z += 0.075f;

   // GL DRAW ARRAYS STUFF GOES HERE

   [(EAGLView *)self.view presentFramebuffer];
}

- (void)initOpenGLES1
{
    // Set the clear color
    glClearColor(0, 0, 0, 1.0f);

    // Projection Matrix config
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    CGSize layerSize = self.view.layer.frame.size;
    gluPerspective(45.0f, (GLfloat)layerSize.width / (GLfloat)layerSize.height, 0.1f, 750.0f);

    // Modelview Matrix config
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    // This next line is not really needed as it is the default for OpenGL ES
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glDisable(GL_BLEND);

    // Enable depth testing
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glDepthMask(GL_TRUE);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:41:12+00:00Added an answer on June 10, 2026 at 12:41 am

    That’s a bit scarce information. How did you set up your viewport? My best guess is you are missing the event that tells you the app has changed orientation. You have to handle either willRotateToInterfaceOrientation:duration: or didRotateFromInterfaceOrientation: and set the new viewport there. The glRotate is not neccessary at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a simple game for the iPhone using OpenGL ES. Everything works fine
I'm drawing a line using OpenGL on the iPhone. I used GLView and GLKView
I am working on a 2D iPhone game using OpenGL ES and I keep
I'm using opengl's selection buffer, but i'm experiencing a trouble, the picking works perfectly
I'm using OpenGL ES 1.1 on the iPhone, and I'd like to use the
I'm using OpenGL ES in my iPhone application and sometimes during startup the screen
I need to create good looking lightning using OpenGL ES 1.1 (iPhone) and was
I am using an opengl es iphone application. What is the most accurate way
I am trying to render to a texture using openGL ES (for iPhone) and
I'm using OpenGL ES to make a game on the iPhone. Unfortunately, I see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.