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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:14:29+00:00 2026-06-14T15:14:29+00:00

I have two arrays that I declared on the stack in a function, and

  • 0

I have two arrays that I declared on the stack in a function, and verified that they both contain the exact same data:

/// Rasters the textured quad using the specified parameters.
- (void)privateConfigureRasterWithTexture:(GLuint)theTexture
                          bottomLeftX:(GLfloat)bottomLeftX
                          bottomLeftY:(GLfloat)bottomLeftY
                            topRightX:(GLfloat)topRightX
                            topRightY:(GLfloat)topRightY
{

    const GLfloat texices[] =
      { bottomLeftX, bottomLeftY,   // bottom left corner
        bottomLeftX,   topRightY,   // top left corner
          topRightX,   topRightY,   // top right corner
          topRightX, bottomLeftY }; // bottom right corner

    const GLfloat texices2[] =
      { 0.0f, 0.0f,
        0.0f, 1.0f,
        1.0f, 1.0f,
        1.0f, 0.0f };

    for(int x=0;x<8;x++)
        if(texices[x] != texices2[x])
        {
            NSLog(@"Mismatch!");
            abort();
        }

When I execute the following line of code in (the bottom of) that function

glVertexAttribPointer(_attributeTexturedTexCoords, 2, GL_FLOAT, GL_FALSE,
                      2*sizeof(GLfloat), texices2);

I get the expected result, however if I instead execute

glVertexAttribPointer(_attributeTexturedTexCoords, 2, GL_FLOAT, GL_FALSE,
                      2*sizeof(GLfloat), texices);

I get a bad result. I don’t get what the difference is.

Edit: Here is how I’m invoking this function.

[self privateConfigureRasterWithTexture:_atlasTexture1
                            bottomLeftX:0.0f
                            bottomLeftY:0.0f
                              topRightX:1.0f
                              topRightY:1.0f];
  • 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-14T15:14:30+00:00Added an answer on June 14, 2026 at 3:14 pm

    Nevermind, I think I’ve found it (probably at around the exact same time Martins did). It looks like glVertexAttribPointer doesn’t make a copy of the data until the call to glDrawElements. Since my glDrawElements is outside of that function, the stack memory was being released (yet for some reason texices2 remained valid).

    I’ve rewritten the code a bit so that texices is heap allocated once when that class is allocated, and just reused over and over again and free’d when the application deallocs.

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

Sidebar

Related Questions

I have two arrays of data that I'm trying to amalgamate. One contains actual
I have multiple function objects declared from the same function that deal with their
I have two arrays that I would like to compare and ultimately wind up
I have two arrays that I create like this: public int GameBoard[][] = new
I have two numpy arrays that define the x and y axes of a
I want to have two arrays: supplierList - that contains the int ID of
Assume that I have two arrays as follow: $array1 = array(1, 3, 5); $array2
Supposed that I have two arrays: Dim RoomName() As String = {(RoomA), (RoomB), (RoomC),
I have two arrays, @names and @employees , that are filled with strings that
I'm trying to come up with a way combine two arrays that have different

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.