Skip to main content
Bounty Awarded with 50 reputation awarded by Rodia
deleted 4 characters in body
Source Link

You were calculating the starting offsets into the buffer to render from incorrectly. The byte offset used is pointer + first * stride. When you call glEnableVertexAttribArrayglVertexAttribPointer in drawObject3 you set the stride to 8 and pointer to 0, so the offset is 8 * 12 which puts you at the start of your second row of data, not the row you expected. The easy way to do it correctly is to set pointer to where the data you want to render starts (18 * 16) and first to 0.

For the last row it would be 18 * 16 + 6 * 8.

You were calculating the starting offsets into the buffer to render from incorrectly. The byte offset used is pointer + first * stride. When you call glEnableVertexAttribArray in drawObject3 you set the stride to 8 and pointer to 0, so the offset is 8 * 12 which puts you at the start of your second row of data, not the row you expected. The easy way to do it correctly is to set pointer to where the data you want to render starts (18 * 16) and first to 0.

For the last row it would be 18 * 16 + 6 * 8.

You were calculating the starting offsets into the buffer to render from incorrectly. The byte offset used is pointer + first * stride. When you call glVertexAttribPointer in drawObject3 you set the stride to 8 and pointer to 0, so the offset is 8 * 12 which puts you at the start of your second row of data, not the row you expected. The easy way to do it correctly is to set pointer to where the data you want to render starts (18 * 16) and first to 0.

For the last row it would be 18 * 16 + 6 * 8.

Source Link

You were calculating the starting offsets into the buffer to render from incorrectly. The byte offset used is pointer + first * stride. When you call glEnableVertexAttribArray in drawObject3 you set the stride to 8 and pointer to 0, so the offset is 8 * 12 which puts you at the start of your second row of data, not the row you expected. The easy way to do it correctly is to set pointer to where the data you want to render starts (18 * 16) and first to 0.

For the last row it would be 18 * 16 + 6 * 8.