Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can call <code>glVertexPointer</code> with the base of your vertex array, and <code>glTexCoordPointer</code> with the base of the texture coords array. As long as the number of things in those arrays line up to the right (same) number of verts, this should work fine.</p> <p>OpenGL can't access members of the structure explicitly. The members will be laid out in memory next to eachother (see caveat below). If multiple Point structures are in a series in memory, effectively you have a big flat list of doubles. OpenGL doesn't know about structures, it just wants one big list of (double in this case) values. But you can build a series of Points and hand OpenGL a pointer to the first one, and if the layout in memory isn't wrong or padded, they'll be equivalent.</p> <p>If you're too new to C to have this conceptually under your belt (along with the memory layout caveats), then you should just copy all the doubles into a new array before calling GL. </p> <p>I do question a couple things: maybe there's missing code here, but having <code>Point**</code> instead of <code>Point*</code> looks fishy, since <code>glVertexPointer</code> etc will expect a flat array of values here. By the same token, although it's probably aligned fine already, in theory an array of those structs might not be flush-packed together in memory. You can do this explicitly depending on your compiler, or you can play with the <code>stride</code> param in the GL calls to be explicit about the distance in memory between each vert.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload