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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:29:03+00:00 2026-05-22T15:29:03+00:00

I could not figure out how to dereference this pointer… sizeof(shapetest2->tripsName) in this line

  • 0

I could not figure out how to dereference this pointer…

sizeof(shapetest2->tripsName) in this line below, it is obviously not going to work because it is a pointer, i could not figure out how to dereference it? (is it easy? or is it a couple steps?, i’ve tried several things, but could not get close) I am not an experience enough coder to figure this particular circumstance out.

glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(shapetest2->tripsName), shapetest2->tripsName);

here is the setup code. (i am experimenting with a VOB in openGL ES 1.5, so if it looks odd, that is why) if i forgot some important setup or definitions, or code, let me know and i’ll include it.

GLsizeiptr dataSize;
GLsizeiptr indexSize;

typedef struct shapeBase {
    void *stripsName[maxStrips];
    void *tripsName;
    void *fansName;
    int   totStrips;
    int   stripsNum[maxStrips];
    int   tripsNum;
    int   totFans;
    int   fansBgn[maxStrips];
    int   fansNum[maxStrips];
    void *dataName;
    void *listOfInserts;
    Vertex3D center;
    Vertex3D radius;
    int   damageMax;
    float weight;
    GLuint bufferName;
    GLuint indexName;
} shapeBase;

static const GLushort test2Trips[] =
{
    0, 1, 3, 1, 2, 3,
    4, 5, 7, 5, 6, 7,
    8, 9, 11, 9, 10, 11,
    12, 13, 15, 13, 14, 15,
    16, 17, 19, 17, 18, 19,
    20, 21, 23, 21, 22, 23,
    24, 25, 27, 25, 26, 27,
    28, 29, 31, 29, 30, 31,
    32, 33, 35, 33, 34, 35,
    36, 37, 39, 37, 38, 39,
    40, 41, 43, 41, 42, 43,
    44, 45, 47, 45, 46, 47,
};

//-------------------------
static inline void shapetest2Setup(void)
{
    shapetest2 = malloc(sizeof(shapeBase));
    shapetest2->stripsName[1]   = NULL;
    shapetest2->tripsName       = &test2Trips;
    shapetest2->fansName        = NULL;
    shapetest2->dataName        = &test2Data;
    shapetest2->totStrips       = 0;
    shapetest2->stripsNum[1]    = 0;
    shapetest2->tripsNum        = 72;
    shapetest2->totFans     = 0;
    shapetest2->listOfInserts   = NULL;
    shapetest2->center      = Vertex3DMake( 0.000000, -0.000000, 2.000000 );
    shapetest2->radius      = Vertex3DMake( 1.000000, 1.000000, 2.000000 );

    dataSize = sizeof(test1Data) + sizeof(test2Data);

    glGenBuffers(1, &mainBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, mainBuffer);
    glBufferData(GL_ARRAY_BUFFER, dataSize, NULL, GL_STATIC_DRAW);

    glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(test1Data), test1Data);
    glBufferSubData(GL_ARRAY_BUFFER, sizeof(test1Data), sizeof(test2Data), test2Data);

//  glGenBuffers(1, &shapetest2->indexName);
//  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, shapetest2->indexName);
//  glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(test2Trips), test2Trips, GL_STATIC_DRAW);


    indexSize = sizeof(test1Trips) + sizeof(test2Trips);

    glGenBuffers(1, &mainIndex);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mainIndex);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize, NULL, GL_STATIC_DRAW);
}


//------------------------------------------------------
static inline void DrawOutShape(void)
{
    glBindBuffer(GL_ARRAY_BUFFER, mainBuffer);


    glVertexPointer(3, GL_FLOAT, sizeof(VertexData3D), (void*)0);
    glNormalPointer(GL_FLOAT, sizeof(VertexData3D), (void*)12);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mainIndex);

//  glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(theInsert->insertName->tripsName), theInsert->insertName->tripsName);

//  glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(test1Trips), test1Trips);
//  glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, sizeof(test1Trips), sizeof(test2Trips), shapetest2->tripsName);

    glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(shapetest2->tripsName), shapetest2->tripsName);


         glDrawElements(GL_TRIANGLES, theInsert->insertName->tripsNum, GL_UNSIGNED_SHORT, (void*)0);


    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);


polys += theInsert->insertName->tripsNum;

}

(theInsert is a handle (pointer to pointer) of the shapetest2, so you can substitute shapetest2 if you see “theInsert->insertName”)

if i comment out the offending line, and uncomment the line above, it is working, but i need this indirection, (and actually i need another level of indirection that you can see in another commented out line) but if i can figure out how to dereference this line, i should be able to do it for another level of indirection?)

  • 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-22T15:29:04+00:00Added an answer on May 22, 2026 at 3:29 pm

    sizeof is compile-time constant that works on exact type you provide. sizeof of void* is just a size of pointer on your machine (likely 4/8 bytes). Just store size along with other data.

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

Sidebar

Related Questions

I have been trying this for some time but could not figure out yet.
I tried inspecting the elements for this website, but I could not figure out
I'm sure this can be done but however I could not figure out to
This is for Python 2.6. I could not figure out why a and b
i just could not figure out how i will put my data on a
I'm trying to play with inter-process communication and since I could not figure out
I am looking at the query syntax . and i could not figure out
it looks very basic thing but i could not figure it out. var email
I'm not seeing the error and was hoping someone could figure it out: public
I could not figure out how to pass a variable number of variables into

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.