Is it possible to make an additional call to glDrawElements to render only a single point from my list of existing indices? I’ve tried doing it and keep getting an access violation. Here’s the method I’m trying to use (with the existing line as well):
I don’t think I’m following you. does that replace the entire last argument or is that supposed to be &m_indices[CurrCellIndex * sizeof(unsigned int)]?
the book I have says that the last argument is supposed to be a pointer to the start of the array. Should my second argument be the CurrCellIndex?
I’ve tried both glDrawElements and glDrawRangeElements and no matter what I do I can’t get it to draw just one point from one index of my existing indices.
I get the first point drawn. It only draws the point represented by the first index, ignoring the start and end values I specify via CurrCellIndex.
Interestingly enough, if I put anything other than 0 in my last argument (such as &m_indices[0], or &m_indices[CurrCellIndex]) I get the access violation.
the last argument is supposed to be a pointer to the start of the array
yes and no. It is a pointer if you use Vertex Arrays (that is if your data is stored in client memory). You are using VBOs which means your data is stored in server memory. The draw functions are overloaded for both uses and depending on what you use (Vertex Arrays vs. VBO) the last argument is either a proper pointer or an offset into the VBO.
Should my second argument be the CurrCellIndex?
no, because you only want to use one index, not CurrCellIndex many.
Actually the above is not entirely correct. It does not matter whether your vertex data is in client or server memory, but where your index data is.
So, if you have uploaded your indices to server memory (using something like glBufferData(GL_ELEMENT_ARRAY_BUFFER, …) ) and have a buffer bound to GL_ELEMENT_ARRAY_BUFFER when making your draw calls, the “indices” pointers are not really pointers, but offsets into the index buffer.