Archived

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

cyansoft

VBO's and missing geometry

Recommended Posts

I just started playing around with VBO''s this weekend and ran into some interesting things with my GeForce2 MX 400 card. I tried rendering a scene with 75000 triangles, so allocated a buffer for 75000*3 vertices with 32 bytes per vertex: - 3 floats for x,y,z (12 bytes) - 3 floats for nx,ny,nz (12 bytes) - 2 floats for s,t (8 bytes) Then I did the following: - Generated a VBO with glGenBuffersARB(...) - Binded the VBO with glBindBufferARB(...) - Passed the buffer size and pointer to glBufferDataARB(...) - Set the pointer for the vertices using glVertexPointer(...), with an offset of 0 - Set the pointer for the normals using glNormalPointer(...), specifying the offset for the normals - Set the pointer for the texture coords using glTexCoordPointer(...), specifying the offset for the coords In my rendering loop, I did the following: - Called glEnableClientState(...) for each client state - Binded the VBO with glBindBufferARB(...) - Called glDrawArrays(GL_TRIANGLES, 0, m_VertexCount) to render - Called glDisableClientState(...) for each client state When I run my program, only about 20% of the geometry shows up! After hours of frustration, I found NeHe''s tutorial #45 about VBO''s. After thinking that I did something wrong, I ran the tutorial and to my surprise, only half the height map appears! The next step was to download the latest nvidia drivers(52.16). Big mistake. Now both my program and NeHe''s was rendering random triangles when using VBO''s. I tried all the drivers in nvidia''s archive, until I reached one without the VBO extension. None of them worked. So I restored my original driver(43.33). I then decided to split the geometry into multiple VBO''s. It finally worked. I found that on the GeForce2 MX, I can''t have more than 16384 triangles in a VBO. Maybe it''s a memory cap(16384 triangles * 3 vertices * 32 bytes is exactly 1.5MB)? Is there any way to query the card to see how much you can put in the VBO? And why didn''t any of the VBO functions return an error code if it obviously couldn''t support all the data I put into it? Bob

Share this post


Link to post
Share on other sites
NVidia cards up to the GeForce 4 only support vertex indexes which are 2 bytes in size, i.e. 0..65535. I don''t know if you''re using indexed vertices or are just sending the vertices sequentially, but it may be that you''ve encountered a certain incarnation of this limitation.
Try rendering in batches of 65536 vertices, shifting the base offset every time(?). I haven''t gotten round to implementing VBOs in my engine yet, so I''m not actually sure how to do it/if it''s possible.

- JQ

Share this post


Link to post
Share on other sites
I''m having problems with the same limitations.
I''m only having problem with indices (glDrawElements() + VBO''s)
glVertexPointer() seems to work for very large buffers, without any error so far.

I''ve not been able to find a error to be produced, or to simply query the max size
(using glGetError() after glBufferDataARB() should produce a OUT_OF_MEMORY, but it doesnt)

If there''s no way to detect this, the max size for a random card could even be 256 for all I know. This would make VBO''s evil >
I''ve mailed NVidia about this, but they ignore the bug (and/or me).
Even if there''s a way around this, its not in the official docs.

(PS: I have a GeForce3 Ti 200)

Share this post


Link to post
Share on other sites
quote:
Original post by JonnyQuest
NVidia cards up to the GeForce 4 only support vertex indexes which are 2 bytes in size, i.e. 0..65535. I don''t know if you''re using indexed vertices or are just sending the vertices sequentially, but it may be that you''ve encountered a certain incarnation of this limitation.
Try rendering in batches of 65536 vertices, shifting the base offset every time(?). I haven''t gotten round to implementing VBOs in my engine yet, so I''m not actually sure how to do it/if it''s possible.

- JQ


I''m rendering everything sequentially. I haven''t bothered working with GL_ELEMENT_ARRAY_BUFFER_ARB yet. Nor have I tried mapping the buffers so I can alter the vertices at runtime.

It does look like the 65536 index limit, because 3 * 16384 fits under it. Maybe the driver converts it to a 4 coordinate(x,y,z,w) vertex internally, thus 16384 triangles is the limit since 4 * 16384 can be indexed between 0 and 65535 without overflowing.

Share this post


Link to post
Share on other sites