813 |
813 |
int index2 = mVBO2.createImmediatelyFloat(mNumVertices*VERT2_SIZE, mVertAttribs2);
|
814 |
814 |
int[] attr = program.mAttribute;
|
815 |
815 |
|
816 |
|
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index1 );
|
817 |
|
GLES30.glVertexAttribPointer(attr[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_POS);
|
818 |
|
GLES30.glVertexAttribPointer(attr[1], NOR_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_NOR);
|
819 |
|
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index2 );
|
820 |
|
GLES30.glVertexAttribPointer(attr[2], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, VERT2_SIZE, OFFSET_TEX);
|
821 |
|
|
822 |
|
// if we are not using component centers and there are no vertex effects enabled,
|
823 |
|
// then this attribute does not exist in the Vertex Shader
|
824 |
|
if( attr.length>=4 )
|
|
816 |
switch( attr.length )
|
825 |
817 |
{
|
826 |
|
GLES30.glVertexAttribPointer(attr[3], COM_DATA_SIZE, GLES30.GL_FLOAT, false, VERT2_SIZE, OFFSET_COM);
|
|
818 |
// 'normal' case
|
|
819 |
case 4: GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index1 );
|
|
820 |
GLES30.glVertexAttribPointer(attr[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_POS);
|
|
821 |
GLES30.glVertexAttribPointer(attr[1], NOR_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_NOR);
|
|
822 |
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index2 );
|
|
823 |
GLES30.glVertexAttribPointer(attr[2], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, VERT2_SIZE, OFFSET_TEX);
|
|
824 |
GLES30.glVertexAttribPointer(attr[3], COM_DATA_SIZE, GLES30.GL_FLOAT, false, VERT2_SIZE, OFFSET_COM);
|
|
825 |
break;
|
|
826 |
// if we are not using component centers and there are no vertex effects enabled,
|
|
827 |
// then component attribute does not exist in the Vertex Shader
|
|
828 |
case 3: GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index1 );
|
|
829 |
GLES30.glVertexAttribPointer(attr[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_POS);
|
|
830 |
GLES30.glVertexAttribPointer(attr[1], NOR_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_NOR);
|
|
831 |
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index2 );
|
|
832 |
GLES30.glVertexAttribPointer(attr[2], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, VERT2_SIZE, OFFSET_TEX);
|
|
833 |
break;
|
|
834 |
// pre program used in EffectQueuePostprocessing does not have v_Normal attribute
|
|
835 |
// (it is not used in the fragment shader)
|
|
836 |
case 2: GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index1 );
|
|
837 |
GLES30.glVertexAttribPointer(attr[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_POS);
|
|
838 |
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index2 );
|
|
839 |
GLES30.glVertexAttribPointer(attr[1], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, VERT2_SIZE, OFFSET_TEX);
|
|
840 |
break;
|
827 |
841 |
}
|
828 |
842 |
|
829 |
843 |
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0);
|
fix detection of not used attributes.