Revision 061449ed
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/examples/triblur/TriblurRenderer.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
54 | 54 |
|
55 |
class TriblurRenderer implements GLSurfaceView.Renderer |
|
55 |
class TriblurRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
56 | 56 |
{ |
57 | 57 |
private static final int NUM = 6; // 6 ints (x,y,z,R,G,B) each describe 1 object below |
58 | 58 |
|
... | ... | |
173 | 173 |
mScreen.render(System.currentTimeMillis()); |
174 | 174 |
} |
175 | 175 |
|
176 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
177 |
|
|
178 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
|
179 |
{ |
|
180 |
mScreenMin = Math.min(width, height); |
|
181 |
|
|
182 |
float factor1 = 0.20f*mScreenMin/OBJ_SIZE; |
|
183 |
float factor2 = 0.75f*factor1; |
|
184 |
mScale1.set(factor1,factor1,factor1); |
|
185 |
mScale2.set(factor2,factor2,factor2); |
|
186 |
mScreen.resize(width, height); |
|
187 |
} |
|
188 |
|
|
176 | 189 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
177 | 190 |
|
178 | 191 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
... | ... | |
198 | 211 |
VertexEffectScale.enable(); |
199 | 212 |
PostprocessEffectBlur.enable(); |
200 | 213 |
FragmentEffectChroma.enable(); |
201 |
|
|
202 |
try |
|
203 |
{ |
|
204 |
DistortedLibrary.onCreate(mView.getContext()); |
|
205 |
} |
|
206 |
catch(Exception ex) |
|
207 |
{ |
|
208 |
android.util.Log.e("Triblur", ex.getMessage() ); |
|
209 |
} |
|
214 |
DistortedLibrary.onCreate(mView.getContext(), this); |
|
210 | 215 |
} |
211 | 216 |
|
212 | 217 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
213 | 218 |
|
214 |
public void onSurfaceChanged(GL10 glUnused, int width, int height)
|
|
219 |
public void distortedException(Exception ex)
|
|
215 | 220 |
{ |
216 |
mScreenMin = Math.min(width, height); |
|
217 |
|
|
218 |
float factor1 = 0.20f*mScreenMin/OBJ_SIZE; |
|
219 |
float factor2 = 0.75f*factor1; |
|
220 |
mScale1.set(factor1,factor1,factor1); |
|
221 |
mScale2.set(factor2,factor2,factor2); |
|
222 |
mScreen.resize(width, height); |
|
221 |
android.util.Log.e("Triblur", ex.getMessage() ); |
|
223 | 222 |
} |
224 | 223 |
|
225 | 224 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Only compile the Full, Normal & OIT programs when they are actually needed.