Note that there are some explanatory texts on larger screens.

plurals
  1. POwhy does binding a GL_ELEMENT_ARRAY_BUFFER to 0 produce a memmove error?
    text
    copied!<p>I had a bug that took me quite some time to fix. I kept getting EXC_BAD_ACCESS and a reference to a memmove error without any further description until I commented the following line: </p> <p>[self loadShaders];</p> <pre><code>glGenVertexArraysOES(1, &amp;_vao); glBindVertexArrayOES(_vao); // Vertex Buffer glGenBuffers(1, &amp;_vertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW); glEnableVertexAttribArray(ATTRIB_VERTEX); glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0); glEnableVertexAttribArray(ATTRIB_TEXTURE); glVertexAttribPointer(ATTRIB_TEXTURE, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 7)); // Index Buffer glGenBuffers(1, &amp;_indexBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER,0); ////////// COMMENTED THIS ONE ////////////// //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);// //////////////////////////////////////////// glBindVertexArrayOES(0); </code></pre> <p>I thought binding a buffer to 0 meant unbinding it, so I really cant understand how would that made my app crash.</p> <p>Thanks for the information! I just do not stay with this concern...</p> <p>My structures:</p> <pre><code>const Vertex Vertices[4] = { {{0.75, -1, 0}, {1, 0, 0, 1}, {0.125, 0.833496}}, {{0.75, 1, 0}, {0, 1, 0, 1}, {0.125, 1}}, {{-0.75, 1, 0}, {0, 0, 1, 1}, {0, 1}}, {{-0.75, -1, 0}, {0, 0, 0, 1}, {0, 0.833496}}, }; const GLushort Indices[6] = { 0, 1, 2, 2, 3, 0 }; </code></pre>
 

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