Triangle Limit ??

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
soconne
Posts: 87
Joined: Fri Mar 05, 2004 2:00 pm

Triangle Limit ??

Post by soconne »

Is there a defined limit to how many triangles Irrlicht will draw to the screen? I drew a 255x255 grid of squares to the screen, hence 255*255*2 triangles and it drew them fine. But when I went to 256x256 grid nothing was drawn. I checked the size of the Vertices and Indices array within the MeshBuffer and they had the correct number.

Does anybody know of any limit such as this? I know its not my code, because any number less than 256 will work just fine, but 'any' number above it will not and nothing will be drawn.
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

hi soconne

the only restriction i know of is that a meshbuffer has only a u16 (unsigned short int) index array, hence only about 65000 indices which makes for 21000 triangles.

if you use several meshbuffers the number of traingles drawn is not limited. (well, fps drops of course)

cheers
tom
soconne
Posts: 87
Joined: Fri Mar 05, 2004 2:00 pm

Post by soconne »

I'm sensing a recompile..... :D
soconne
Posts: 87
Joined: Fri Mar 05, 2004 2:00 pm

Post by soconne »

Perhaps this should be done in version 0.7. Cause what if someone wants to display a model over 66,000 triangles ?? It won't happen because Indices in MeshBuffer is of u16 type, and Vertices is s32 type. So this is kind of a problem.

I just tried changing everything I could think of in the engine to change all these types to u32, I then recompiled and for some reason I must have changed some wrong things because triangles end up missing in the BSP example, and my original problem still persists.

I really 'hope' niko will add this to version 0.7 :D
Blivvy
Posts: 3
Joined: Thu Mar 18, 2004 1:03 am
Location: Hampshire, England

Post by Blivvy »

The problem here has its roots in hardware. The reason why the indices are of u16 type is because all but the more recent graphics cards have only a 16bit index buffer. Even if Irrlicht did represent the indices as u32 the chances are that the graphics card won't be capable of receiving a buffer that size anyway. If you want your program to work for the majority of people you're going to have to split that mesh up :).

[edit] Niko has 32bit indices planned on his TODO list.
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

Blivvy wrote:The problem here has its roots in hardware. The reason why the indices are of u16 type is because all but the more recent graphics cards have only a 16bit index buffer.
Good to know :) thanks Blivvy
Post Reply