Revision 061449ed
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 48 |
|
49 |
class MovingEffectsRenderer implements GLSurfaceView.Renderer |
|
49 |
class MovingEffectsRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
50 | 50 |
{ |
51 | 51 |
private MovingEffectsSurfaceView mView; |
52 | 52 |
private Canvas mCanvas; |
... | ... | |
128 | 128 |
|
129 | 129 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
130 | 130 |
|
131 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
|
|
131 |
public void onDrawFrame(GL10 glUnused)
|
|
132 | 132 |
{ |
133 |
VertexEffectScale.enable(); |
|
134 |
VertexEffectSwirl.enable(); |
|
135 |
VertexEffectDeform.enable(); |
|
136 |
VertexEffectSink.enable(); |
|
137 |
FragmentEffectChroma.enable(); |
|
138 |
FragmentEffectAlpha.enable(); |
|
133 |
long time = System.currentTimeMillis(); |
|
139 | 134 |
|
140 |
try |
|
141 |
{ |
|
142 |
DistortedLibrary.onCreate(mView.getContext()); |
|
143 |
} |
|
144 |
catch(Exception ex) |
|
135 |
if (mView.getCurrentEffect() == MovingEffectsSurfaceView.EFFECT_POINTS && mRefresh ) |
|
145 | 136 |
{ |
146 |
android.util.Log.e("MovingEffects", ex.getMessage() ); |
|
137 |
drawBackground(); |
|
138 |
mView.drawCurve(mCanvas,time); |
|
139 |
mTexture.setTexture(mBitmap); |
|
140 |
mRefresh = false; |
|
147 | 141 |
} |
142 |
|
|
143 |
mScreen.render(time); |
|
148 | 144 |
} |
149 | 145 |
|
150 | 146 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
170 | 166 |
|
171 | 167 |
mRefresh = true; |
172 | 168 |
} |
173 |
|
|
169 |
|
|
174 | 170 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
175 |
|
|
176 |
public void onDrawFrame(GL10 glUnused) |
|
177 |
{ |
|
178 |
long time = System.currentTimeMillis(); |
|
179 |
|
|
180 |
if (mView.getCurrentEffect() == MovingEffectsSurfaceView.EFFECT_POINTS && mRefresh ) |
|
181 |
{ |
|
182 |
drawBackground(); |
|
183 |
mView.drawCurve(mCanvas,time); |
|
184 |
mTexture.setTexture(mBitmap); |
|
185 |
mRefresh = false; |
|
186 |
} |
|
187 |
|
|
188 |
mScreen.render(time); |
|
171 |
|
|
172 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
|
173 |
{ |
|
174 |
VertexEffectScale.enable(); |
|
175 |
VertexEffectSwirl.enable(); |
|
176 |
VertexEffectDeform.enable(); |
|
177 |
VertexEffectSink.enable(); |
|
178 |
FragmentEffectChroma.enable(); |
|
179 |
FragmentEffectAlpha.enable(); |
|
180 |
|
|
181 |
DistortedLibrary.onCreate(mView.getContext(), this); |
|
189 | 182 |
} |
190 | 183 |
|
191 | 184 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
185 |
|
|
186 |
public void distortedException(Exception ex) |
|
187 |
{ |
|
188 |
android.util.Log.e("MovingEffects", ex.getMessage() ); |
|
189 |
} |
|
192 | 190 |
} |
Also available in: Unified diff
Only compile the Full, Normal & OIT programs when they are actually needed.