Revision 9f9924f8
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/mesh/MeshBase.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import org.distorted.library.effect.MatrixEffect; |
27 | 27 |
import org.distorted.library.effect.VertexEffect; |
28 |
import org.distorted.library.effectqueue.EffectQueue; |
|
28 | 29 |
import org.distorted.library.main.InternalBuffer; |
29 | 30 |
import org.distorted.library.program.DistortedProgram; |
30 | 31 |
import org.distorted.library.type.Static4D; |
... | ... | |
87 | 88 |
|
88 | 89 |
DeferredJobs.JobNode[] mJobNode; |
89 | 90 |
|
91 |
private static int[] mCenterBlockIndex = new int[EffectQueue.MAIN_VARIANTS]; |
|
92 |
private static int[] mAssocBlockIndex = new int[EffectQueue.MAIN_VARIANTS]; |
|
93 |
|
|
90 | 94 |
private static final int TEX_COMP_SIZE = 5; // 5 four-byte entities inside the component |
91 | 95 |
|
92 | 96 |
private static class TexComponent |
... | ... | |
531 | 535 |
return MAX_EFFECT_COMPONENTS; |
532 | 536 |
} |
533 | 537 |
|
538 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
539 |
|
|
540 |
public static void getUniforms(int programH, int variant) |
|
541 |
{ |
|
542 |
mCenterBlockIndex[variant]= GLES30.glGetUniformBlockIndex(programH, "componentCenter"); |
|
543 |
mAssocBlockIndex[variant] = GLES30.glGetUniformBlockIndex(programH, "componentAssociation"); |
|
544 |
} |
|
545 |
|
|
534 | 546 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
535 | 547 |
/** |
536 | 548 |
* Not part of public API, do not document (public only because has to be used from the main package) |
... | ... | |
676 | 688 |
* |
677 | 689 |
* @y.exclude |
678 | 690 |
*/ |
679 |
public void send(int programH) |
|
691 |
public void send(int programH, int variant)
|
|
680 | 692 |
{ |
681 | 693 |
int indexA = mUBA.getIndex(); |
682 | 694 |
GLES30.glBindBufferBase(GLES30.GL_UNIFORM_BUFFER, ASSOC_UBO_BINDING, indexA); |
683 |
GLES30.glUniformBlockBinding(programH, ASSOC_UBO_BINDING, indexA);
|
|
695 |
GLES30.glUniformBlockBinding(programH, mAssocBlockIndex[variant], ASSOC_UBO_BINDING);
|
|
684 | 696 |
|
685 | 697 |
int indexC = mUBC.getIndex(); |
686 | 698 |
GLES30.glBindBufferBase(GLES30.GL_UNIFORM_BUFFER, CENTER_UBO_BINDING, indexC); |
687 |
GLES30.glUniformBlockBinding(programH, CENTER_UBO_BINDING, indexC);
|
|
699 |
GLES30.glUniformBlockBinding(programH, mCenterBlockIndex[variant], CENTER_UBO_BINDING);
|
|
688 | 700 |
} |
689 | 701 |
|
690 | 702 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Remove the 'binding' parameter from the UBO in the vertex shader - this is not part of OpenGL ES 3.0, only introduced in 3.1, and we want to be compatible with 3.0.
Now we need to dynamically detect the UBO index and form a BlockBinding ourselves.