Log in or register to post comments

Object rendering depends upon NumVerts ?

September 26, 2012 - 11:02pm #1

Hello, 

I am trying Image target sample example run with simple object's .h file containing limited number of vertext (for ex. 19121) it runs fine. But when I try it with spiderlampNumVerts = 87642; it will not render object properly and when I again try with some more complex object wich has spiderlampNumVerts = 87642 greater than that (ex. 148302), It unable to draw an object on target. I want to ask is there vertext limitation or it depends upon number of vertext then what is the max limiting number of vertext of object which will drown properly?

Object rendering depends upon NumVerts ?

October 9, 2012 - 5:46am #3

Hi ChetanBhoyar,

you actually pointed out one known limitation of OpenGL ES (as opposed to regular desktop OpenGL);

OpenGL ES (in all its flavours, i.e. both 1.1 and 2.0) only accepts index arrays (see glDrawElements function in ImageTargets.cpp) of type "short" or "unsigned short", but does not accept "integers" or "unsigned integers" (see also the use of the GL_UNSIGNED_SHORT constant used in the glDrawElements call);

this limits the total number of vertices (indices) to a maximum of 65534 (i.e. the largest possible unsigned short value);

in regular desktop OpenGL, you could use GL_UNSIGNED_INT and then pass an index array of "integers", with much larger limits (practically no limits), but this is not the case for OpenGL ES (i.e. OpenGL for mobile devices);

since Android and iOS systems rely on OpenGL ES (and so does Vuforia), you are practically limited in the number of vertices, as you also discovered with your experiments;

so, for example, if you had a mesh of around 60,000 indices it would still work (except maybe it would be a bit slow to render), but as soon as you pass the limit of 65K you won't be able to render it anymore (ina  single draw call to glDrawElements).

Note, if you are using glDrawArrays instead of glDrawElements, technically you're not using indices, but just vertices; however in practice you will still be limited in the actual number of vertices you can use (in practice the limit should still be around 65K vertices).

A work-around for that (if you really need larger meshes), is to split your mesh into multiple chunks of vertices, and then call glDrawElements or glDrawArrays (and all related code such as glVertexPointer etc.) multiple times, i.e. once for ach chunk of data.

I hope this helps.

 

 

more in general

Object rendering depends upon NumVerts ?

September 27, 2012 - 2:22am #2

Hi Chetan,

This is more an OpenGL ES question as this will handle any limitations.

My suggestion is to take the object you have and try to draw it outside of Vuforia, probably within a separate simpler test harness that you can run on the simulator (to speed up development time).  Once this is successful you can try importing into Vuforia

N

Log in or register to post comments