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 197537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:51:41+00:00 2026-05-11T16:51:41+00:00

I am trying to learn to write OpenGL apps for the iPhone. How can

  • 0

I am trying to learn to write OpenGL apps for the iPhone. How can I port the following code to work with OpenGL-ES? I know that I must store the vertices in an array and then call glDrawArrays(), but is there an optimal way to do this? My thought is to create a very large array and simply keep a counter of how many spaces are filled. This there a better approach? What about using an NSArray and then converting back to a c array?

glBegin(GL_LINE_STRIP);

z = -50.0f;
for(angle = 0.0f; angle <= (2.0f*3.1415f)*3.0f; angle += 0.1f)
    {
    x = 50.0f*sin(angle);
    y = 50.0f*cos(angle);

    // Specify the point and move the Z value up a little   
    glVertex3f(x, y, z);
    z += 0.5f;
    }

// Done drawing points
glEnd();
  • 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-11T16:51:41+00:00Added an answer on May 11, 2026 at 4:51 pm

    If you have sufficient space and know the maximum size of the array, it’s simplest to use one big statically allocated array and just keep track of its current logical size.

    If memory is scant but processor resources are plentiful then pack the array on the fly and then register the arrays and call glDrawArrays().

    The hybrid approach would be to use a dynamically allocated array that can be updated (if necessary). You can do this manually by reallocating a dynamic array when it approaches becoming full or by using an NSMutableArray of some sort. (N.B. NSArray is for static arrays; NSMutableArrays (subclass) are dynamic. See here.)

    Hope this helped 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 106k
  • Answers 106k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can do this anyway you want, just completely abstract… May 11, 2026 at 8:57 pm
  • Editorial Team
    Editorial Team added an answer First step would be to compare record counts. You can… May 11, 2026 at 8:57 pm
  • Editorial Team
    Editorial Team added an answer I have to come up with a contrived method to… May 11, 2026 at 8:57 pm

Related Questions

I am trying to write a cross-platform python program that would run in the
I am working on an application that will have online and offline components and
Here are two chunks of code that accomplish (what I think is) the same
I am a ASP.NET Developer trying to learn Rails and RESTful approach. To understand,
I am trying to figure out how to use ASP.NET MVC and it seems

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.