Jump to content
  • Advertisement
Sign in to follow this  
Kincaid

VBO's

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

im about to start implementing VBO's to speed up my redering (they're the fastest way right ?) but im not clear about the following with vbo's (and also vertex arrays), when drawing 2 triangles that share two points, you will still always need 6 vertices in memory, eventhough there are only 4 unique ones ? right ? (and thus, in editing, you must maintain/have duplicate values) thanx

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Kincaid
with vbo's (and also vertex arrays), when drawing 2 triangles that share two points, you will still always need 6 vertices in memory, eventhough there are only 4 unique ones ? right ?
Nope, because when rendering from VBOs you will use 'indexed triangle lists', which allow you to refer to the same vertex multiple times. duplicate positions are only necessary if you need different normal vectors or texture coordinates for the different faces.

Share this post


Link to post
Share on other sites
A point can be shared between two triangles if all of it's attributes are the same like position, texture coordinates, etc... In general when you specify an index OpenGL will take vertexArray[index],texcoordArray[index]...

Hope this helps.

EDIT: ninja'd

Share this post


Link to post
Share on other sites
whats the call for that ? glIndexPointer refers to colors, and is the only thing with index I find on msdn.

Share this post


Link to post
Share on other sites
lets see if im getting it..
Is this the correct/fastest way ?

lets say i have 10000 vertices. I place them all in an array and pass that to glVertexPointer (once, at init).
then, at each frame i determine some subset ofvertices, lets say n, and create an int array of n long, with indexes to the vertices.
then i call DrawElements passing the index array to render the frame

it will only execute n times?

(edit: its dynamic data, positions in the vertex array may update per frame (or not))

[Edited by - Kincaid on January 6, 2009 5:20:59 AM]

Share this post


Link to post
Share on other sites
with glDrawElements you can draw the whole thing or a portion of the buffer

for instance:

int indexCount;
glDrawElements(GL_TRIANGLE_STRIP, indexCount, GL_UNSIGNED_INT, 0);

will draw the whole array.

where:
glDrawElements(GL_TRIANGLE_STRIP, 50, GL_UNSIGNED_INT, 0);

will draw the first 50 elements.


the above is assuming you have an index buffer created and bound.

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.

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!