Weird VBO speed boost?

Hi,

I have been toying with a rather large VBO to try and speed it up and I have been able to double the framerate but I am not sure how it works.

This is the code I am using to draw my VBO.

 
	glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices );
	glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL );	

	glDrawArrays( GL_TRIANGLES, 0, m_nVertexCount );
 

Now if I alter the glDrawArrays line to look like:

 
glDrawArrays( GL_TRIANGLES, 0, m_nVertexCount/10 );
 

It speeds up incredibly. But isn’t the last parameter supposed to be how many vertices I am using?

Please note that when I do this, I lose nothing visually whatsoever. Which is the puzzling part for me. But it only seems to work for numbers between 6 and 10.

So if I divide it by 4 or 20, I get parts of my VBO missing.

Why is this so?

“But isn’t the last parameter supposed to be how many vertices I am using?”

That’s how it reads in the red book…

When you say you lose nothing visually whatsoever, do you mean that a difference calculation (like in photoshop) between a screenshot without the altered line, and a screenshot with the altered line, produces a result of zero?

Or is it that there’s no obvious difference by visual inspection?

Does the same thing happen with some simple data that you generate in-program, ie a 2D array of triangles on a square grid?

What is the data in the VBO, and where did it come from?

Well… you don’t see difference because your cam is not aimed to missing part of mesh :slight_smile:

I suppose that your problem is in vertex dataset. Maybe vertices in your dataset is duplicated.

Better check for GL errors. You’ll find something odd!

you don’t see difference because your cam is not aimed to missing part of mesh
I have been all over the mesh and nothing is missing. It is only when I use values less than 6 and higher than 10 that I get pieces missing.

I will try the GL errors and see what it says.

And as for the no visual difference, it was on inspection, but I just did a screenshot of before and after and still no difference in comparison.

Just tried error checking and it came up clean as a whistle.

The data in the VBO is created at runtime from values in an image.

I have not tried this with smaller, simpler VBO’s.

But even so. I should not be able to divide the number of vertices I am currently sending by 10 and not see any visible difference.

** I am sending a total of (204820486)/10 vertices before the extra divide by 10.

Which then makes it (204820486)/100 after the divide which still produces the same results, no visual loss, increase in speed?

tried it with a cube?

I too experienced all sorts of speed boosts, loss, spikes and valleys with nVidia drivers < 90.0 when using VBO and PBO. I switch to 91.28 beta and life is much better now.

I think knackered got head+nail. :slight_smile:

To add my own 0.02,
2048^26/10sizof(float)3 = 28.8MB. That could be considered a rather substantial amount of vertex data in a single VBO. Btw, 2048^26/10 = 2516582.4. That’s not an even number of triangles. If you send an invalid count for a specified primitive to DrawArrays (in this case, (count%3)!=0), an error is flagged and nothing is drawn.

This is not perchance a continuation of this thread ?

I am not getting any errors :S and it is all drawn :S

I am (int)ing it but just checked and that does not even create enough for triangles.

I am now dividing it by multiples of 3, I can divide it by up to 99, as before I was dividing by a total of 100, to get the same speed boost, and am still not losing anything on the screen.

BTW, just checked and a division of 99 still isn’t correct for triangles.

I am using drivers 84.43 with my 6800, I will try newer drivers and report back.

But even still, I am getting no errors, everything is drawing correctly, yet I am telling it to draw ALOT less than before, and the speed has increased dramatically. This does not make any sense.

** Just updated the drivers and now nothing shows, which does suggest an error. I want my old drivers back :frowning:

So how can I get this to work? It must be just a little mathematical error.

My loop to create the vbo vertices looks like:

 
int tLOD = 10;
int vertexCount = (int)(2048*2048*6)/tLOD;
for (mapZ = 0; mapZ < Height; mapZ+=tLOD){ 
for (mapX = 0; mapX < Width; mapX+=tLOD){ 
Create 6 vertices for 2 triangles for each section
}
} 
 

So in that, I am creating 6 vertices for every 10 places. Setting tLOD to 1 looks a little better, but takes so much longer to create and is alot slower to run, I came to the conclusion that tLOD set to 10 is best.

Should I have it something like:
vertexCount = ((MapWidth/8)*(MapHeight/8)*6)?

So I am still creating 6 per space, but I am creating 8 times less and it is still divisible by 3. But still shows nothing on screen.

And is not reporting any errors.

*It was originally based on NeHe code for the VBO, have just gone back and tried it with the exact same variables as on the NeHe tutorial, and it still shows up blank. Is there a limit to how big a VBO can be?

I think I have fixed it, I am getting even faster frame rates now.

The reason it was showing blank in the last post, I found out was due to the change in the VBO disrupting the diffuse colour in my shader (maybe I moved something incorrectly).

Anwyay, now all the calculations add up to correct multiples. (thnx Tamlin)

Thanks guys.

p.s. The new drivers wouldn’t have caused the change in my shader would it?