Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ilici

VBO and VertexArrays problem

This topic is 5562 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

hi, i've implemented VBOs for my terrain renderer and got a big boost in FPS. but now when i try to use vertex arrays after using VBO i get weird artifacts. code using VBOs
	char* VertexPointer = BUFFER_OFFSET(0);
	char* ColorPointer = BUFFER_OFFSET(sizeof(float) * 4);
	char* TexCoordPointer = BUFFER_OFFSET(sizeof(float) * 2);

	GL.EnableClientState(GL_VERTEX_ARRAY);
	GL.EnableClientState(GL_COLOR_ARRAY);
	GL.BindBuffer(GL_ARRAY_BUFFER_ARB, VB.GetName());

	GL.SetVertexPointer(2, GL_FLOAT, sizeof(tTerrainVertex), VertexPointer);
	GL.SetColorPointer(4, GL_FLOAT, sizeof(tTerrainVertex), ColorPointer);
	GL.SetTexCoordPointer(2, GL_FLOAT, sizeof(tTerrainVertex), TexCoordPointer);

       // bind tex


	GL.DrawIndexedArrays(GL_TRIANGLE_STRIP, PATCH_SIZE * (PATCH_SIZE + 1) * 2, GL_UNSIGNED_SHORT, pPatches[offset].pIndices);


	GL.DisableClientState(GL_VERTEX_ARRAY);
	GL.DisableClientState(GL_TEXTURE_COORD_ARRAY);
	GL.DisableClientState(GL_COLOR_ARRAY);

	GL.BindBuffer(GL_ARRAY_BUFFER_ARB, 0);


code with VertexArrays:

   
	GL.EnableClientState(GL_VERTEX_ARRAY);
	GL.EnableClientState(GL_TEXTURE_COORD_ARRAY);

	GL.SetVertexPointer(2, GL_FLOAT, 0, Vertices);
	GL.SetTexCoordPointer(2, GL_FLOAT, 0, TexCoords);
	GL.DrawArrays(GL_QUADS, 0, 4);

	GL.DisableClientState(GL_VERTEX_ARRAY);
	GL.DisableClientState(GL_TEXTURE_COORD_ARRAY);

.: My Site :. [640k Should Be Enough for Anybody - Bill Gates] [Death to the gaming industry! Long live games - The Scratchware Manifesto]
/*ilici*/ [edited by - Ilici on September 24, 2003 10:46:02 AM]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!