[solved] addSphereSceneNode/polyCount and PrimitiveCount

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
miko93
Posts: 54
Joined: Sat Nov 12, 2005 5:24 pm
Location: Regensburg, Germany
Contact:

[solved] addSphereSceneNode/polyCount and PrimitiveCount

Post by miko93 »

Hello there,

I just noticed that when adding one debug sphere to my scene, the primitive count goes up more than I'd expected:

Code: Select all

gl_Data.pSceneManager->addSphereSceneNode(0.2f,16,0,-1,vPosition);
gives me an increase in primtive count of 512. Checking this with

Code: Select all

gl_Data.pVideoDriver->getPrimitiveCountDrawn()
Now, instead of 512, I'd expected to see an increase of 16 here, as the polyCount value given to addSphereSceneNode is 16. As far as I checked, my code is not executed more than once.

I understand I got the term "polyCount" wrong. What exactly does it stand for?

Thanks a lot for your help
Last edited by miko93 on Mon Jan 07, 2008 1:01 pm, edited 1 time in total.
"Yessir, I'll be happy to make these unnecessary changes to this irrelevant document." (Dilbert)
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The value 16 that you are passing to addSphereSceneNode() is not the total number of polys to use to make the sphere, it is the number of polys per row/column of the sphere.

Imagine you had a sphere with 16 rows and 16 columns and unwrapped it into a grid. The total number of cells in the grid would be 16 * 16 = 256. Now imagine that each cell of the grid is made of two triangles [primitives]. The total number of primitives for your sphere can would be (16 * 16) * 2 = 512. More generally, it would be (polyCount * polyCount) * 2.

Travis
miko93
Posts: 54
Joined: Sat Nov 12, 2005 5:24 pm
Location: Regensburg, Germany
Contact:

Post by miko93 »

vitek, thanks a lot.
I felt free to ask for adding this explanation to the irrlicht helpfile (over there in the bug reports forum).

miko
"Yessir, I'll be happy to make these unnecessary changes to this irrelevant document." (Dilbert)
Post Reply