Revision 78ff6ea9
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/effectqueue/EffectQueueFragment.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
private static final int INDEX = EffectType.FRAGMENT.ordinal(); |
36 | 36 |
|
37 |
private static int[] mNumEffectsH = new int[MAIN_VARIANTS];
|
|
38 |
private static int[] mNameH = new int[MAIN_VARIANTS];
|
|
39 |
private static int[] mUniformsH = new int[MAIN_VARIANTS];
|
|
37 |
private final static int[] mNumEffectsH = new int[MAIN_VARIANTS];
|
|
38 |
private final static int[] mUniformsH = new int[MAIN_VARIANTS];
|
|
39 |
private final static int[] mPropBlockIndex= new int[MAIN_VARIANTS];
|
|
40 | 40 |
|
41 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 42 |
|
... | ... | |
56 | 56 |
|
57 | 57 |
static void uniforms(int mProgramH, int variant) |
58 | 58 |
{ |
59 |
mNumEffectsH[variant]= GLES30.glGetUniformLocation( mProgramH, "fNumEffects");
|
|
60 |
mNameH[variant] = GLES30.glGetUniformLocation( mProgramH, "fName");
|
|
61 |
mUniformsH[variant] = GLES30.glGetUniformLocation( mProgramH, "fUniforms");
|
|
59 |
mNumEffectsH[variant] = GLES30.glGetUniformLocation ( mProgramH, "fNumEffects");
|
|
60 |
mUniformsH[variant] = GLES30.glGetUniformLocation ( mProgramH, "fUniforms");
|
|
61 |
mPropBlockIndex[variant] = GLES30.glGetUniformBlockIndex( mProgramH, "fUniformProperties");
|
|
62 | 62 |
} |
63 | 63 |
|
64 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
82 | 82 |
|
83 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
84 | 84 |
|
85 |
void send(int variant) |
|
85 |
void send(int programH, int variant)
|
|
86 | 86 |
{ |
87 | 87 |
GLES30.glUniform1i( mNumEffectsH[variant], mNumEffects); |
88 | 88 |
|
89 | 89 |
if( mNumEffects>0 ) |
90 | 90 |
{ |
91 |
GLES30.glUniform1iv( mNameH[variant] , mNumEffects, mIntUniforms , 0); |
|
91 |
int index = mUBP.getIndex(); |
|
92 |
GLES30.glBindBufferBase(GLES30.GL_UNIFORM_BUFFER, PROP_FRAG_UBO_BINDING, index); |
|
93 |
GLES30.glUniformBlockBinding(programH, mPropBlockIndex[variant], PROP_FRAG_UBO_BINDING); |
|
92 | 94 |
GLES30.glUniform4fv( mUniformsH[variant],(NUM_FLOAT_UNIFORMS/4)*mNumEffects, mFloatUniforms, 0); |
93 | 95 |
} |
94 | 96 |
} |
Also available in: Unified diff
Convert the Integer part (i.e. effect names and the two associations) of vertex and fragment shaders to Uniform Buffer Objects.
Next: convert the last part, i.e. the float effect parameters.