Number of meshFaces in RoomCapture app are always 0


#1

Hello,

We are trying to port the RoomCapture app to Swift and are facing a problem while trying to render a partial mesh.

We are using the glDrawElements as shown below

glDrawElements(GLenum(GL_TRIANGLES), GLsizei(d!.numTriangleIndices[meshIndex]),
                           GLenum(GL_UNSIGNED_SHORT), nil)

but, the d!.numTriangleIndices[meshIndex] which is numberOfMeshFaces * 3 is always 0 even though we are getting values for numberOfMeshVertices in the range of ~2000.

Can anyone shed some light on why this might be happening?

Thank you.


#2

Without seeing more of the ported code, it’s hard to determine what is actually going on, but my idea is that the meshIndex you are passing to numTriangleIndices is either 0 or referencing a sub-mesh that doesn’t actually exist.

It could also be that you aren’t referencing the pointer correctly. Could you try to use the following line instead:

glDrawElements(GLenum(GL_TRIANGLES), GLsizei(d->numTriangleIndices[meshIndex]),
GLenum(GL_UNSIGNED_SHORT), nil)

Let me know if either of these suggestions help!

Thanks!


#3

Hey Anthony,

The partial mesh did exist but we screwed up on a pointer input for a GLK4Matrix.

It’s sorta working now.

Thanks