Jump to content
  • Advertisement
Sign in to follow this  
avocados

glDrawElements on vbo

This topic is 4522 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

No problem using glDrawArrays on a vbo or glDrawElements in immediate mode but I can't get anything drawn using glDrawElements on a vbo.
	glGenBuffers(2, &buf[0]);
	glBindBuffer(GL_ARRAY_BUFFER, buf[0]);
	glBufferData(GL_ARRAY_BUFFER, HEIGHTM_WIDTH*HEIGHTM_WIDTH*TUXYZ*sizeof(float), 
		&mesh[0][0][0], GL_STATIC_DRAW);
	glInterleavedArrays(GL_T2F_V3F, 0, NULL );
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	glEnableClientState(GL_VERTEX_ARRAY);

	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf[1]);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, HEIGHTM_WIDTH*2*sizeof(float), 
		&meshIndices[0][0], GL_STATIC_DRAW);

	glDrawElements(GL_TRIANGLE_STRIP, HEIGHTM_WIDTH*2, GL_UNSIGNED_INT, NULL);
I keep checking my arrays and indices, I think they are good. Did I skip a step in setting up the indices array? Note that I'm just drawing the first triangle strip in this height map, which was fine in the other modes.

Share this post


Link to post
Share on other sites
Advertisement
The only obvious thing I can see wrong with that is the use of "sizeof(float)" when specifying the size of the index array, but that shouldn't make any difference as it should match "sizeof(unsigned int)" anyway.
Maybe more code would help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!