PDA

View Full Version : vbo fail with huge vertex num (>10million vertexes



flypig
10-27-2011, 12:04 AM
it works fine under 5 million vertexes
every step glGetError returns no error, but when call

glDrawElements(GL_QUADS, 4*pBuf->m_nQuadCnt, GL_UNSIGNED_INT, (char *) NULL);

it crash

what can i to do with this problem? :(
thanks

mobeen
10-27-2011, 12:25 AM
You have not given us enough info.
Which hardware are u running this on? May be u r exceeding the memory limits?

flypig
10-27-2011, 01:28 AM
it is nvidia geforce gt 420
driver date : 2011/4/7
driver version : 8.17.12.6812

how to judge whether glBufferDataARB malloc too many vram?
there is no return error like GL_OUT_OF_MEMORY ect.

flypig
10-27-2011, 01:54 AM
i split it into blocks, every block have maximum vertex limit(say, like
65535),then use glDrawElements(GL_QUADS,.., GL_UNSIGNED_SHORT,(char *) NULL) instead of glDrawElements(GL_QUADS,.., GL_UNSIGNED_INT,(char *) NULL) .(because i saw nvidia vbo white papar ,it says 16bit index can gain
2*x speed),but it still crash in huge models....
is sombody meet same problem?
can anybody help me?

flypig
10-27-2011, 05:21 PM
i am perplexed at the problem.
i have to query vedio card memory, if glBufferDataARB exceed it, then not use vbo to draw the model

V-man
10-28-2011, 04:17 AM
You can check what the maximum is with glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &value)
and
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &value)

Are you saying you can't render more than 65535 vertices at a time? That seems rather low.

Dan Bartlett
10-28-2011, 05:31 AM
GL_MAX_ELEMENTS_VERTICES/GL_MAX_ELEMENTS_INDICES are a hint of the maximum number of elements issued in one go that will give maximum performance.


Implementations denote recommended maximum amounts of vertex and index
data, which may be queried by calling GetIntegerv with the symbolic constants
MAX_ELEMENTS_VERTICES and MAX_ELEMENTS_INDICES. If end - start + 1
is greater than the value of MAX_ELEMENTS_VERTICES, or if count is greater than
the value of MAX_ELEMENTS_INDICES, then the call may operate at reduced performance.


You've shown how many indices are being used, but how many vertices are being used + how many bytes does each vertex consist of? Is each index value pointing to a unique vertex? If you have 5 million unique vertices + each is taking 64 bytes, that's 320 MB used for vertices + 20 MB for index data.

Are you allocating the right sized buffer objects? Do you have index values referencing vertices that are beyond the range of the buffer object containing them? If so, you may encounter problems at the draw call.

Maybe seeing some more code fo buffer object allocation + vertex pointer setup might be helpful.

Alfonse Reinheart
10-28-2011, 10:27 AM
GL_MAX_ELEMENTS_VERTICES/GL_MAX_ELEMENTS_INDICES are a hint of the maximum number of elements issued in one go that will give maximum performance.

Also, note that the hint itself only applies to glDrawRangeElements.