glDrawRangeElements(GL_TRIANGLE_STRIP, 5600,5600+448,448, GL_UNSIGNED_INT,0);
glDrawRangeElements(GL_TRIANGLE_STRIP, 0,448,448, GL_UNSIGNED_INT,0);
But in both situations I see same part of buffer. I can't start for example from 56th index. I heart about glPrimitiveRestartIndex but I'm not sure how to use it.
VBO - drawing part of buffer
I want to draw only part of (indexed) VBO. So:
Both of these functions start at the same offset (zero) and render 448 elements. The index ranges are optimisations for the active array ranges covered by the indices, not offsets into the index array. Try putting your index offset into the indices pointer param.
Jans.
Jans.
What is on your index buffer? You should use the last parameter as an offset into the IBO, and move it appropiately to match the 56th index.
Sth works but it's strange. First image for:
Two different VBO's, in both situations - squares (5x5 vertices) - parts of bigger 129x129 VBOs. No problems.
2nd:
Also good - 2 squares per VBO.
Now I want to show only 2nd square:
Result:
That's strange but I checked also:
Result:
Looks like the offset value is only 25% of value which I need. I can draw all parts of VBO but I must multiply offset by 4. I don't understand why.
glDrawElements(GL_TRIANGLE_STRIP,56, GL_UNSIGNED_INT,0);
Two different VBO's, in both situations - squares (5x5 vertices) - parts of bigger 129x129 VBOs. No problems.
2nd:
glDrawElements(GL_TRIANGLE_STRIP,112, GL_UNSIGNED_INT,0);
Also good - 2 squares per VBO.
Now I want to show only 2nd square:
unsigned int offset = 56;glDrawElements(GL_TRIANGLE_STRIP,56, GL_UNSIGNED_INT,((GLvoid *) offset));
Result:
That's strange but I checked also:
unsigned int offset = 56*4;glDrawElements(GL_TRIANGLE_STRIP,56, GL_UNSIGNED_INT,((GLvoid *) offset));
Result:
Looks like the offset value is only 25% of value which I need. I can draw all parts of VBO but I must multiply offset by 4. I don't understand why.
IIRC the offset is given in bytes. Since you specify your indices to be unsigned integers (4 bytes) you'd have to multiply your integer offset by 4 to get the byte offset.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement