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

  • Home
  • SEARCH
  • 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 3351452
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:54:37+00:00 2026-05-18T01:54:37+00:00

I’m trying to view some 3d geometry in a custom ipad application I’m writing.

  • 0

I’m trying to view some 3d geometry in a custom ipad application I’m writing. Problem I’m running into is that as I zoom, pan and rotate my model, the edges get clipped, and I’m not sure why. I don’t think it’s because of the near/far clipping planes because I change those and nothing happens, it still clips. Also, it does it in only one direction. The other direction renders just fine. Any ideas? The transformation matrix is created using an arcball manipulation class I created, but I only included a hardcoded view matrix for obvious reasons. The hardcoded matrix shows the problem just fine. The scene just has a bunch of squares being rendered that get clipped on two of the corners.

To duplicate my problem, create a new opengl es project for the iPad, then paste the following code at the end of the ES1Renderer.m init method before “return self;”:

glMatrixMode(GL_PROJECTION);
CGRect frame = [[UIScreen mainScreen] bounds];
glViewport(0, 0, frame.size.width, frame.size.height);
glFrustumf(-1000, 1000, -1000, 1000, 10000, 10000);

now replace the entire render method with the following:

static const GLfloat squareVertices[] = {
-0.5f,  -0.5f,
0.5f,  -0.5f,
-0.5f,   0.5f,
0.5f,   0.5f,
};

[EAGLContext setCurrentContext:context];

glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);

glClearColor(0.5f, 0.5f, 0.5f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

CGRect frame = [[UIScreen mainScreen] bounds];

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, frame.size.width, frame.size.height);
glFrustumf(0, backingWidth, 0, backingHeight, -.1, -1000);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

float mat2[16];

mat2[0] = .268496;
mat2[1] = .082372;
mat2[2] = .127658;
mat2[3] = 0;
mat2[4] = .051842;
mat2[5] = .193987;
mat2[6] = -.234207;
mat2[7] = 0;
mat2[8] = -.142808;
mat2[9] = .225290;
mat2[10] = .154991;
mat2[11] = 0;
mat2[12] = .034580;
mat2[13] = -.001087;
mat2[14] = -.013952;
mat2[15] = 1;

glMultMatrixf(mat2);

glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);

for (float i = 0; i <= 6; i += 2) {
    for (float j = 0; j <= 6; j+= 2) {
        glPushMatrix();
        glColor4f(i/6, j/6, 0, 1);
        glTranslatef(i-3, j-3, 0);
        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
        glPopMatrix();
    }
}

glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];

finally, in the EAGLView.m file, replace the following line in the initWithCoder method

renderer = [[ES2Renderer alloc] init];

with:

renderer = [[ES1Renderer alloc] init];

and run. You will see the grid of squares rotated at an angle and the upper left and lower right edges are clipped. This is what I can’t figure out how to get rid of. Any help is appreciated. Thanks.

  • 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-05-18T01:54:38+00:00Added an answer on May 18, 2026 at 1:54 am

    This is strange:

    glFrustumf(0, backingWidth, 0, backingHeight, -.1, -1000);
    

    The last two values are the values for the near and far planes. These are both negative values. From what I can see, you are working only at z=0 which lies outside this range. It’s weird that you’re seeing anything.

    What if you change this to:

    glFrustumf(0, backingWidth, 0, backingHeight, 1000, -1000);
    

    ? Also the first four values correspond to left, right, top and bottom. These are all positive values while your squares could potentially have negative values. What if you make them more balanced as in

    glFrustumf(-10, 10, -10, 10, 1000, -1000);
    

    ??

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

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.