PDA

View Full Version : Help with iOS instancing



Rakehell
10-03-2013, 07:13 AM
I understand there's a way to instance by sending the modelview matrix as an attribute. I've got the sample code, but I don't understand it. Does anyone know how this works? I don't know how to send multiple meshes at once.

http://nukecode.blogspot.com/2011/07/geometry-instancig-for-iphone-wip.html

maconbot
01-16-2014, 10:07 AM
Basically it saves on the CPU by only handling the meshes on the GPU.

slmille4
01-18-2014, 06:59 PM
I understand there's a way to instance by sending the modelview matrix as an attribute. I've got the sample code, but I don't understand it. Does anyone know how this works? I don't know how to send multiple meshes at once.


1. I believe you mean sending the model/viewprojection matrices as uniforms, attributes can only take vectors and scalars.
2. To do instancing, you buffer in a single mesh, and use separate matrices to place each instance. For example:

glUniformMatrix4fv(uniforms[UNIFORM_MODEL_MATRIX_LIST], MAX_INSTANCE_COUNT, GL_FALSE, _modelMatrixList->m);

uploads an array of model matrices to use for each instance