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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:12:18+00:00 2026-06-09T09:12:18+00:00

I’m new to OpenGL ES, but quite experienced with Objective-C and iOS development. I’ve

  • 0

I’m new to OpenGL ES, but quite experienced with Objective-C and iOS development. I’ve so far had no problem drawing and coloring shapes using vertex buffer objects, by defining an array of vertices and a corresponding array of indicies, with the following code

GLuint vertexBuffer;
glGenBuffers(1, &vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(Verticies), Verticies, GL_STATIC_DRAW);

GLuint indexBuffer;
glGenBuffers(1, &indexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);

Then drawing to the screen with the following code:

glDrawElements(GL_TRIANGLES, sizeof(Indices)/sizeof(Indices[0]), GL_UNSIGNED_BYTE, 0);
[_context presentRenderbuffer:GL_RENDERBUFFER];

This is all fine for basic shapes that I can define myself in code. Now I’ve had someone generate .h files that have been exported from a 3D graphics program, that contain the info needed to define a shape, but they don’t contain an index array. Instead the index information has somehow been embedded in the vertex array. The vertex array has repeated coordinates that define the order in which they should be drawn. See the sample code below. I also now have an array of normals and an array of texture coordinates. Can anyone tell me (or point me to to a tutorial/guide) how I would go about using (read: drawing with) this data as opposed to the separate vertex/index arrays as before? Thanks in advance!

#define poleNumVerts 276

static const float poleVerts [] = {
  // f 1/1/1 2/2/2 3/3/3
  -0.0170377877807436, -0.00478429549256308, 0.5,
  -0.0170377877807436, 0.00409214741631937, 0.5,
  -0.0176220932500109, -0.00034605799118996, 0.5,
  // f 2/2/2 1/1/1 4/4/4
  -0.0170377877807436, 0.00409214741631937, 0.5,
  -0.0170377877807436, -0.00478429549256308, 0.5,
  -0.015324690688248, -0.00892006666692703, 0.5,
  // f 2/2/2 4/4/4 5/5/5
  -0.0170377877807436, 0.00409214741631937, 0.5,
  -0.015324690688248, -0.00892006666692703, 0.5,
  -0.015324690688248, 0.00822795297696595, 0.5,
  // f 5/5/5 4/4/4 6/6/6
  -0.015324690688248, 0.00822795297696595, 0.5,
  -0.015324690688248, -0.00892006666692703, 0.5,
  -0.012599557156627, 0.0117794232669002, 0.5,
  // f 6/6/6 4/4/4 7/7/7
  -0.012599557156627, 0.0117794232669002, 0.5,
  -0.015324690688248, -0.00892006666692703, 0.5,
  -0.012599557156627, -0.0124715369568613, 0.5,
  // f 6/6/6 7/7/7 8/8/8
  -0.012599557156627, 0.0117794232669002, 0.5,
  -0.012599557156627, -0.0124715369568613, 0.5,
  -0.0090480845742739, -0.015196688827833, 0.5,

  ...... <code truncated>... };


static const float poleNormals [] = {
  // f 1/1/1 2/2/2 3/3/3
  0, 0, 1,
  0, 0, 1,
  0, 0, 1,
  // f 2/2/2 1/1/1 4/4/4
  0, 0, 1,
  0, 0, 1,
  0, 0, 1,
  // f 2/2/2 4/4/4 5/5/5
  0, 0, 1,
  0, 0, 1,
  0, 0, 1,
  // f 5/5/5 4/4/4 6/6/6
  0, 0, 1,
  0, 0, 1,
  0, 0, 1,
  // f 6/6/6 4/4/4 7/7/7
  0, 0, 1,
  0, 0, 1,
  0, 0, 1,
  // f 6/6/6 7/7/7 8/8/8
  0, 0, 1,
  0, 0, 1,
  0, 0, 1,
  // f 6/6/6 8/8/8 9/9/9

  ...... <code truncated>...};

static const float poleTexCoords [] = {
  // f 1/1/1 2/2/2 3/3/3
  0.939514, 0.37333,
  0.928115, 0.619208,
  0.950000, 0.49702,
  // f 2/2/2 1/1/1 4/4/4
  0.928115, 0.619208,
  0.939514, 0.37333,
  0.897372, 0.25657,
  // f 2/2/2 4/4/4 5/5/5
  0.928115, 0.619208,
  0.897372, 0.25657,
  0.875352, 0.73157,
  // f 5/5/5 4/4/4 6/6/6
  0.875352, 0.73157,
  0.897372, 0.25657,
  0.795305, 0.826446,
  // f 6/6/6 4/4/4 7/7/7
  0.795305, 0.826446,
  0.897372, 0.25657,
  0.826446, 0.154695,
  // f 6/6/6 7/7/7 8/8/8
  0.795305, 0.826446,
  0.826446, 0.154695,
  0.731570, 0.074647,
  // f 6/6/6 8/8/8 9/9/9
  0.795305, 0.826446,
  0.731570, 0.074647,
  0.693430, 0.897371,

  ..... <code truncated>.... };
  • 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-09T09:12:19+00:00Added an answer on June 9, 2026 at 9:12 am

    If you don’t have a list of indexes, it seems likely that you’re expected to draw all of the vertexes in order. You can do this with glDrawArrays rather than glDrawElements. They are the same, but the former doesn’t use an index array (it is equivalent to passing an index array of {0, 1, 2, 3, ...} to glDrawElements).

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I've tracked down a weird MySQL problem to the two different ways I was

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.