Revision 061449ed
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 50 |
|
51 |
class AroundTheWorldRenderer implements GLSurfaceView.Renderer |
|
51 |
class AroundTheWorldRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
52 | 52 |
{ |
53 | 53 |
private GLSurfaceView mView; |
54 | 54 |
private DistortedEffects mEffects; |
... | ... | |
146 | 146 |
FragmentEffectChroma.enable(); |
147 | 147 |
FragmentEffectContrast.enable(); |
148 | 148 |
|
149 |
try
|
|
150 |
{
|
|
151 |
DistortedLibrary.onCreate(mView.getContext()); |
|
152 |
}
|
|
153 |
catch(Exception ex) |
|
154 |
{
|
|
155 |
android.util.Log.e("AroundTheWorld", ex.getMessage() );
|
|
156 |
}
|
|
149 |
DistortedLibrary.onCreate(mView.getContext(),this);
|
|
150 |
}
|
|
151 |
|
|
152 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
153 |
|
|
154 |
public void distortedException(Exception ex)
|
|
155 |
{
|
|
156 |
android.util.Log.e("AroundTheWorld", ex.getMessage() );
|
|
157 | 157 |
} |
158 | 158 |
} |
src/main/java/org/distorted/examples/bean/BeanRenderer.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 46 |
|
47 |
class BeanRenderer implements GLSurfaceView.Renderer
|
|
47 |
class BeanRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
48 | 48 |
{ |
49 | 49 |
private GLSurfaceView mView; |
50 | 50 |
private DistortedEffects mEffects; |
... | ... | |
162 | 162 |
|
163 | 163 |
VertexEffectDistort.enable(); |
164 | 164 |
|
165 |
try
|
|
166 |
{
|
|
167 |
DistortedLibrary.onCreate(mView.getContext()); |
|
168 |
}
|
|
169 |
catch(Exception ex) |
|
170 |
{
|
|
171 |
android.util.Log.e("Bean", ex.getMessage() );
|
|
172 |
}
|
|
165 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
166 |
}
|
|
167 |
|
|
168 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
169 |
|
|
170 |
public void distortedException(Exception ex)
|
|
171 |
{
|
|
172 |
android.util.Log.e("Bean", ex.getMessage() );
|
|
173 | 173 |
} |
174 | 174 |
} |
src/main/java/org/distorted/examples/blur/BlurRenderer.java | ||
---|---|---|
45 | 45 |
|
46 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 | 47 |
|
48 |
class BlurRenderer implements GLSurfaceView.Renderer |
|
48 |
class BlurRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
49 | 49 |
{ |
50 | 50 |
private final static int SIZE = 500; |
51 | 51 |
|
... | ... | |
146 | 146 |
|
147 | 147 |
PostprocessEffectBlur.enable(); |
148 | 148 |
|
149 |
try
|
|
150 |
{
|
|
151 |
DistortedLibrary.onCreate(mView.getContext()); |
|
152 |
}
|
|
153 |
catch(Exception ex) |
|
154 |
{
|
|
155 |
android.util.Log.e("Blur", ex.getMessage() );
|
|
156 |
}
|
|
149 |
DistortedLibrary.onCreate(mView.getContext(),this);
|
|
150 |
}
|
|
151 |
|
|
152 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
153 |
|
|
154 |
public void distortedException(Exception ex)
|
|
155 |
{
|
|
156 |
android.util.Log.e("Blur", ex.getMessage() );
|
|
157 | 157 |
} |
158 | 158 |
} |
src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 50 |
|
51 |
class CatAndDogRenderer implements GLSurfaceView.Renderer |
|
51 |
class CatAndDogRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
52 | 52 |
{ |
53 | 53 |
private GLSurfaceView mView; |
54 | 54 |
private DistortedTexture mTexture; |
... | ... | |
158 | 158 |
FragmentEffectChroma.enable(); |
159 | 159 |
FragmentEffectAlpha.enable(); |
160 | 160 |
|
161 |
try
|
|
162 |
{
|
|
163 |
DistortedLibrary.onCreate(mView.getContext()); |
|
164 |
}
|
|
165 |
catch(Exception ex) |
|
166 |
{
|
|
167 |
android.util.Log.e("CatAndDog", ex.getMessage() );
|
|
168 |
}
|
|
161 |
DistortedLibrary.onCreate(mView.getContext(),this);
|
|
162 |
}
|
|
163 |
|
|
164 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
165 |
|
|
166 |
public void distortedException(Exception ex)
|
|
167 |
{
|
|
168 |
android.util.Log.e("CatAndDog", ex.getMessage() );
|
|
169 | 169 |
} |
170 | 170 |
} |
src/main/java/org/distorted/examples/check/CheckRenderer.java | ||
---|---|---|
55 | 55 |
|
56 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
57 | 57 |
|
58 |
class CheckRenderer implements GLSurfaceView.Renderer
|
|
58 |
class CheckRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
59 | 59 |
{ |
60 | 60 |
private static String compilationResult; |
61 | 61 |
private static String compilationTitle; |
... | ... | |
201 | 201 |
mDeform1.set( 0, 0, 0); |
202 | 202 |
mDeform2.set( 0, mObjHeight, 0); |
203 | 203 |
|
204 |
try |
|
205 |
{ |
|
206 |
DistortedLibrary.onCreate(mView.getContext()); |
|
207 |
} |
|
208 |
catch(Exception ex) |
|
204 |
DistortedLibrary.onCreate(mView.getContext(),this); |
|
205 |
} |
|
206 |
|
|
207 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
208 |
// We have failed to compile or link shaders - probably too many effects. |
|
209 |
// (each effect adds a certain number of Uniforms to the shader and there |
|
210 |
// can only be a limited number of those ) |
|
211 |
|
|
212 |
public void distortedException(Exception ex) |
|
213 |
{ |
|
214 |
compilationTitle = ex.getClass().getSimpleName(); |
|
215 |
compilationResult= ex.getMessage(); |
|
216 |
|
|
217 |
String ver; |
|
218 |
|
|
219 |
ver = GLES31.glGetString(GLES31.GL_SHADING_LANGUAGE_VERSION); |
|
220 |
compilationResult += "\n\nGLSL version: "+(ver==null ? "null" : ver); |
|
221 |
ver = GLES31.glGetString(GLES31.GL_VERSION); |
|
222 |
compilationResult += "\nGL version: "+(ver==null ? "null" : ver); |
|
223 |
ver = GLES31.glGetString(GLES31.GL_VENDOR); |
|
224 |
compilationResult += "\nGL vendor: "+(ver==null ? "null" : ver); |
|
225 |
ver = GLES31.glGetString(GLES31.GL_RENDERER); |
|
226 |
compilationResult += "\nGL renderer: "+(ver==null ? "null" : ver); |
|
227 |
|
|
228 |
CheckActivity act = (CheckActivity)mView.getContext(); |
|
229 |
|
|
230 |
act.runOnUiThread(new Runnable() |
|
209 | 231 |
{ |
210 |
// We have failed to compile or link shaders - probably too many effects. |
|
211 |
// (each effect adds a certain number of Uniforms to the shader and there |
|
212 |
// can only be a limited number of those ) |
|
213 |
|
|
214 |
compilationTitle = ex.getClass().getSimpleName(); |
|
215 |
compilationResult= ex.getMessage(); |
|
216 |
|
|
217 |
String ver; |
|
218 |
|
|
219 |
ver = GLES31.glGetString(GLES31.GL_SHADING_LANGUAGE_VERSION); |
|
220 |
compilationResult += "\n\nGLSL version: "+(ver==null ? "null" : ver); |
|
221 |
ver = GLES31.glGetString(GLES31.GL_VERSION); |
|
222 |
compilationResult += "\nGL version: "+(ver==null ? "null" : ver); |
|
223 |
ver = GLES31.glGetString(GLES31.GL_VENDOR); |
|
224 |
compilationResult += "\nGL vendor: "+(ver==null ? "null" : ver); |
|
225 |
ver = GLES31.glGetString(GLES31.GL_RENDERER); |
|
226 |
compilationResult += "\nGL renderer: "+(ver==null ? "null" : ver); |
|
227 |
|
|
228 |
CheckActivity act = (CheckActivity)mView.getContext(); |
|
229 |
|
|
230 |
act.runOnUiThread(new Runnable() |
|
232 |
public void run() |
|
231 | 233 |
{ |
232 |
public void run() |
|
234 |
Context context = mView.getContext(); |
|
235 |
|
|
236 |
AlertDialog.Builder builder = new AlertDialog.Builder(context); |
|
237 |
builder.setTitle(compilationTitle); |
|
238 |
builder.setMessage(compilationResult); |
|
239 |
builder.setCancelable(true); |
|
240 |
|
|
241 |
builder.setOnCancelListener(new DialogInterface.OnCancelListener() |
|
233 | 242 |
{ |
234 |
Context context = mView.getContext(); |
|
235 |
|
|
236 |
AlertDialog.Builder builder = new AlertDialog.Builder(context); |
|
237 |
builder.setTitle(compilationTitle); |
|
238 |
builder.setMessage(compilationResult); |
|
239 |
builder.setCancelable(true); |
|
240 |
|
|
241 |
builder.setOnCancelListener(new DialogInterface.OnCancelListener() |
|
243 |
@Override |
|
244 |
public void onCancel(DialogInterface dialog) |
|
242 | 245 |
{ |
243 |
@Override |
|
244 |
public void onCancel(DialogInterface dialog) |
|
245 |
{ |
|
246 |
((CheckActivity)mView.getContext()).finish(); |
|
247 |
} |
|
248 |
}); |
|
249 |
|
|
250 |
AlertDialog alert = builder.create(); |
|
251 |
alert.show(); |
|
252 |
} |
|
253 |
}); |
|
254 |
} |
|
246 |
((CheckActivity)mView.getContext()).finish(); |
|
247 |
} |
|
248 |
}); |
|
249 |
|
|
250 |
AlertDialog alert = builder.create(); |
|
251 |
alert.show(); |
|
252 |
} |
|
253 |
}); |
|
255 | 254 |
} |
256 |
|
|
257 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
258 |
|
|
259 | 255 |
} |
src/main/java/org/distorted/examples/deferredjob/DeferredJobRenderer.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
49 | 49 |
|
50 |
class DeferredJobRenderer implements GLSurfaceView.Renderer |
|
50 |
class DeferredJobRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
51 | 51 |
{ |
52 | 52 |
private GLSurfaceView mView; |
53 | 53 |
private DistortedTexture mTexture; |
... | ... | |
134 | 134 |
DistortedLibrary.setMax(EffectType.VERTEX, 11); |
135 | 135 |
VertexEffectRotate.enable(); |
136 | 136 |
|
137 |
try
|
|
138 |
{
|
|
139 |
DistortedLibrary.onCreate(mView.getContext()); |
|
140 |
}
|
|
141 |
catch(Exception ex) |
|
142 |
{
|
|
143 |
android.util.Log.e("DeferredJob", ex.getMessage() );
|
|
144 |
}
|
|
137 |
DistortedLibrary.onCreate(mView.getContext(),this);
|
|
138 |
}
|
|
139 |
|
|
140 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
141 |
|
|
142 |
public void distortedException(Exception ex)
|
|
143 |
{
|
|
144 |
android.util.Log.e("DeferredJob", ex.getMessage() );
|
|
145 | 145 |
} |
146 | 146 |
|
147 | 147 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/deform/DeformRenderer.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 50 |
|
51 |
class DeformRenderer implements GLSurfaceView.Renderer, EffectListener |
|
51 |
class DeformRenderer implements GLSurfaceView.Renderer, EffectListener, DistortedLibrary.ExceptionListener
|
|
52 | 52 |
{ |
53 | 53 |
private static final int NUM_VECTORS = 8; |
54 | 54 |
private static final int NUM_LINES = 10; |
... | ... | |
230 | 230 |
VertexEffectDistort.enable(); |
231 | 231 |
VertexEffectDeform.enable(); |
232 | 232 |
|
233 |
try
|
|
234 |
{
|
|
235 |
DistortedLibrary.onCreate(mView.getContext()); |
|
236 |
}
|
|
237 |
catch(Exception ex) |
|
238 |
{
|
|
239 |
android.util.Log.e("Deform", ex.toString() );
|
|
240 |
}
|
|
233 |
DistortedLibrary.onCreate(mView.getContext(),this);
|
|
234 |
}
|
|
235 |
|
|
236 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
237 |
|
|
238 |
public void distortedException(Exception ex)
|
|
239 |
{
|
|
240 |
android.util.Log.e("Deform", ex.getMessage() );
|
|
241 | 241 |
} |
242 | 242 |
|
243 | 243 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 50 |
|
51 |
class DifferentBitmapsRenderer implements GLSurfaceView.Renderer
|
|
51 |
class DifferentBitmapsRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
52 | 52 |
{ |
53 | 53 |
private static final int[] bitmap = { R.raw.dog, R.raw.face, R.raw.cat }; |
54 | 54 |
private static final int NUM = bitmap.length; |
... | ... | |
168 | 168 |
VertexEffectSink.enable(); |
169 | 169 |
VertexEffectDistort.enable(); |
170 | 170 |
|
171 |
try
|
|
172 |
{
|
|
173 |
DistortedLibrary.onCreate(mView.getContext()); |
|
174 |
}
|
|
175 |
catch(Exception ex) |
|
176 |
{
|
|
177 |
android.util.Log.e("Renderer", ex.getMessage() );
|
|
178 |
}
|
|
171 |
DistortedLibrary.onCreate(mView.getContext(),this);
|
|
172 |
}
|
|
173 |
|
|
174 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
175 |
|
|
176 |
public void distortedException(Exception ex)
|
|
177 |
{
|
|
178 |
android.util.Log.e("DifferentBitmaps", ex.getMessage() );
|
|
179 | 179 |
} |
180 | 180 |
|
181 | 181 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java | ||
---|---|---|
50 | 50 |
|
51 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 52 |
|
53 |
class DifferentEffectsRenderer implements GLSurfaceView.Renderer
|
|
53 |
class DifferentEffectsRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
54 | 54 |
{ |
55 | 55 |
private static final int NUM = 3; |
56 | 56 |
|
... | ... | |
188 | 188 |
VertexEffectDistort.enable(); |
189 | 189 |
FragmentEffectChroma.enable(); |
190 | 190 |
|
191 |
try
|
|
192 |
{
|
|
193 |
DistortedLibrary.onCreate(mView.getContext()); |
|
194 |
}
|
|
195 |
catch(Exception ex) |
|
196 |
{
|
|
197 |
android.util.Log.e("DifferentEffects", ex.getMessage() );
|
|
198 |
}
|
|
191 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
192 |
}
|
|
193 |
|
|
194 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
195 |
|
|
196 |
public void distortedException(Exception ex)
|
|
197 |
{
|
|
198 |
android.util.Log.e("DifferentEffects", ex.getMessage() );
|
|
199 | 199 |
} |
200 | 200 |
} |
src/main/java/org/distorted/examples/dynamic/DynamicRenderer.java | ||
---|---|---|
38 | 38 |
|
39 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 40 |
|
41 |
class DynamicRenderer implements GLSurfaceView.Renderer |
|
41 |
class DynamicRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
42 | 42 |
{ |
43 | 43 |
private DynamicSurfaceView mView; |
44 | 44 |
private DistortedTexture mTexture; |
... | ... | |
72 | 72 |
} |
73 | 73 |
|
74 | 74 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
75 |
|
|
76 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
|
77 |
{ |
|
78 |
try |
|
79 |
{ |
|
80 |
DistortedLibrary.onCreate(mView.getContext()); |
|
81 |
} |
|
82 |
catch(Exception ex) |
|
83 |
{ |
|
84 |
android.util.Log.e("Renderer", ex.getMessage() ); |
|
85 |
} |
|
75 |
|
|
76 |
public void onDrawFrame(GL10 glUnused) |
|
77 |
{ |
|
78 |
long time = System.currentTimeMillis(); |
|
79 |
|
|
80 |
mCanvas.drawRect(0, 0, texW, texH, mPaint); |
|
81 |
mView.drawCurve(mCanvas,time); |
|
82 |
mTexture.setTexture(mBitmap); |
|
83 |
mScreen.render( System.currentTimeMillis() ); |
|
86 | 84 |
} |
87 | 85 |
|
88 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
103 | 101 |
mView.onSurfaceChanged(texW,texH); |
104 | 102 |
DynamicSurfaceView.surfaceChanged(texW,texH); |
105 | 103 |
} |
106 |
|
|
104 |
|
|
107 | 105 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
108 |
|
|
109 |
public void onDrawFrame(GL10 glUnused) |
|
110 |
{ |
|
111 |
long time = System.currentTimeMillis(); |
|
112 |
|
|
113 |
mCanvas.drawRect(0, 0, texW, texH, mPaint); |
|
114 |
mView.drawCurve(mCanvas,time); |
|
115 |
mTexture.setTexture(mBitmap); |
|
116 |
mScreen.render( System.currentTimeMillis() ); |
|
106 |
|
|
107 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
|
108 |
{ |
|
109 |
DistortedLibrary.onCreate(mView.getContext(),this); |
|
110 |
} |
|
111 |
|
|
112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
113 |
|
|
114 |
public void distortedException(Exception ex) |
|
115 |
{ |
|
116 |
android.util.Log.e("Dynamic", ex.getMessage() ); |
|
117 | 117 |
} |
118 | 118 |
} |
src/main/java/org/distorted/examples/earth/EarthRenderer.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 | 64 |
|
65 |
class EarthRenderer implements GLSurfaceView.Renderer |
|
65 |
class EarthRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
66 | 66 |
{ |
67 | 67 |
private static final float RADIUS_V= 1.0f/ 8; |
68 | 68 |
private static final float RADIUS_F= 1.0f/15; |
... | ... | |
281 | 281 |
DistortedLibrary.setMax(EffectType.VERTEX , MAX_EFF); |
282 | 282 |
DistortedLibrary.setMax(EffectType.FRAGMENT, MAX_EFF); |
283 | 283 |
|
284 |
try
|
|
285 |
{
|
|
286 |
DistortedLibrary.onCreate(mView.getContext()); |
|
287 |
}
|
|
288 |
catch(Exception ex) |
|
289 |
{
|
|
290 |
android.util.Log.e("Earth", ex.getMessage() );
|
|
291 |
}
|
|
284 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
285 |
}
|
|
286 |
|
|
287 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
288 |
|
|
289 |
public void distortedException(Exception ex)
|
|
290 |
{
|
|
291 |
android.util.Log.e("Earth", ex.getMessage() );
|
|
292 | 292 |
} |
293 | 293 |
} |
src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 46 |
|
47 |
class EffectQueueRenderer implements GLSurfaceView.Renderer, EffectListener |
|
47 |
class EffectQueueRenderer implements GLSurfaceView.Renderer, EffectListener, DistortedLibrary.ExceptionListener
|
|
48 | 48 |
{ |
49 | 49 |
private static final int NUMLINES = 10; |
50 | 50 |
private static final int MESH_QUALITY = 100; |
... | ... | |
93 | 93 |
return mEffects; |
94 | 94 |
} |
95 | 95 |
|
96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
97 |
|
|
98 |
public void onDrawFrame(GL10 glUnused) |
|
99 |
{ |
|
100 |
mScreen.render( System.currentTimeMillis() ); |
|
101 |
} |
|
102 |
|
|
103 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
104 |
|
|
105 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
|
106 |
{ |
|
107 |
// (w+h)/2 because we need to stretch more or less uniformly in all 3 directions. |
|
108 |
// If we set it to 0, Distort would not be shaded. If we set it to 1, the Distorted normal |
|
109 |
// vectors would get stretched only in X and Y dirs, becoming very 'flat' and the Distorted |
|
110 |
// area very dark. |
|
111 |
mScale.set(width, height, (width+height)*0.5f); |
|
112 |
|
|
113 |
mScreen.resize(width,height); |
|
114 |
mView.setScreenSize(width,height); |
|
115 |
} |
|
116 |
|
|
96 | 117 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
97 | 118 |
|
98 | 119 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
... | ... | |
120 | 141 |
FragmentEffectChroma.enable(); |
121 | 142 |
FragmentEffectSaturation.enable(); |
122 | 143 |
|
123 |
try |
|
124 |
{ |
|
125 |
DistortedLibrary.onCreate(mView.getContext()); |
|
126 |
} |
|
127 |
catch(Exception ex) |
|
128 |
{ |
|
129 |
android.util.Log.e("EffectQueue", ex.getMessage() ); |
|
130 |
} |
|
144 |
DistortedLibrary.onCreate(mView.getContext(), this); |
|
131 | 145 |
} |
132 | 146 |
|
133 | 147 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
134 | 148 |
|
135 |
public void onSurfaceChanged(GL10 glUnused, int width, int height)
|
|
149 |
public void distortedException(Exception ex)
|
|
136 | 150 |
{ |
137 |
// (w+h)/2 because we need to stretch more or less uniformly in all 3 directions. |
|
138 |
// If we set it to 0, Distort would not be shaded. If we set it to 1, the Distorted normal |
|
139 |
// vectors would get stretched only in X and Y dirs, becoming very 'flat' and the Distorted |
|
140 |
// area very dark. |
|
141 |
mScale.set(width, height, (width+height)*0.5f); |
|
142 |
|
|
143 |
mScreen.resize(width,height); |
|
144 |
mView.setScreenSize(width,height); |
|
145 |
} |
|
146 |
|
|
147 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
148 |
|
|
149 |
public void onDrawFrame(GL10 glUnused) |
|
150 |
{ |
|
151 |
mScreen.render( System.currentTimeMillis() ); |
|
151 |
android.util.Log.e("EffectQueue", ex.getMessage() ); |
|
152 | 152 |
} |
153 | 153 |
|
154 | 154 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/flag/FlagRenderer.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
49 | 49 |
|
50 |
class FlagRenderer implements GLSurfaceView.Renderer |
|
50 |
class FlagRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
51 | 51 |
{ |
52 | 52 |
private GLSurfaceView mView; |
53 | 53 |
private DistortedTexture mTexture; |
... | ... | |
191 | 191 |
VertexEffectScale.enable(); |
192 | 192 |
VertexEffectWave.enable(); |
193 | 193 |
|
194 |
try
|
|
195 |
{
|
|
196 |
DistortedLibrary.onCreate(mView.getContext()); |
|
197 |
}
|
|
198 |
catch(Exception ex) |
|
199 |
{
|
|
200 |
android.util.Log.e("Flag", ex.getMessage() );
|
|
201 |
}
|
|
194 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
195 |
}
|
|
196 |
|
|
197 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
198 |
|
|
199 |
public void distortedException(Exception ex)
|
|
200 |
{
|
|
201 |
android.util.Log.e("Flag", ex.getMessage() );
|
|
202 | 202 |
} |
203 | 203 |
} |
src/main/java/org/distorted/examples/generic/GenericRenderer.java | ||
---|---|---|
49 | 49 |
|
50 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
51 | 51 |
|
52 |
class GenericRenderer implements GLSurfaceView.Renderer |
|
52 |
class GenericRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
53 | 53 |
{ |
54 | 54 |
private static final float FOV = 30.0f; |
55 | 55 |
private static final float NEAR = 0.1f; |
... | ... | |
322 | 322 |
Effect.enableEffects(EffectType.FRAGMENT); |
323 | 323 |
Effect.enableEffects(EffectType.POSTPROCESS); |
324 | 324 |
|
325 |
try
|
|
326 |
{
|
|
327 |
DistortedLibrary.onCreate(mView.getContext()); |
|
328 |
}
|
|
329 |
catch(Exception ex) |
|
330 |
{
|
|
331 |
android.util.Log.e("Effects3D", ex.getMessage() );
|
|
332 |
}
|
|
325 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
326 |
}
|
|
327 |
|
|
328 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
329 |
|
|
330 |
public void distortedException(Exception ex)
|
|
331 |
{
|
|
332 |
android.util.Log.e("Generic", ex.getMessage() );
|
|
333 | 333 |
} |
334 | 334 |
} |
src/main/java/org/distorted/examples/girl/GirlRenderer.java | ||
---|---|---|
50 | 50 |
|
51 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 52 |
|
53 |
class GirlRenderer implements GLSurfaceView.Renderer
|
|
53 |
class GirlRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
54 | 54 |
{ |
55 | 55 |
private GLSurfaceView mView; |
56 | 56 |
private DistortedEffects mEffects; |
... | ... | |
212 | 212 |
VertexEffectSink.enable(); |
213 | 213 |
VertexEffectSwirl.enable(); |
214 | 214 |
|
215 |
try
|
|
216 |
{
|
|
217 |
DistortedLibrary.onCreate(mView.getContext()); |
|
218 |
}
|
|
219 |
catch(Exception ex) |
|
220 |
{
|
|
221 |
android.util.Log.e("Girl", ex.getMessage() );
|
|
222 |
}
|
|
215 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
216 |
}
|
|
217 |
|
|
218 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
219 |
|
|
220 |
public void distortedException(Exception ex)
|
|
221 |
{
|
|
222 |
android.util.Log.e("Girl", ex.getMessage() );
|
|
223 | 223 |
} |
224 | 224 |
} |
src/main/java/org/distorted/examples/glow/GlowRenderer.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 46 |
|
47 |
class GlowRenderer implements GLSurfaceView.Renderer |
|
47 |
class GlowRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
48 | 48 |
{ |
49 | 49 |
private static final float HALO_TO_RADIUS = 0.2f; |
50 | 50 |
|
... | ... | |
146 | 146 |
|
147 | 147 |
PostprocessEffectGlow.enable(); |
148 | 148 |
|
149 |
try
|
|
150 |
{
|
|
151 |
DistortedLibrary.onCreate(mView.getContext()); |
|
152 |
}
|
|
153 |
catch(Exception ex) |
|
154 |
{
|
|
155 |
android.util.Log.e("Glow", ex.getMessage() );
|
|
156 |
}
|
|
149 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
150 |
}
|
|
151 |
|
|
152 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
153 |
|
|
154 |
public void distortedException(Exception ex)
|
|
155 |
{
|
|
156 |
android.util.Log.e("Glow", ex.getMessage() );
|
|
157 | 157 |
} |
158 | 158 |
} |
src/main/java/org/distorted/examples/inflate/InflateRenderer.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 42 |
|
43 |
class InflateRenderer implements GLSurfaceView.Renderer |
|
43 |
class InflateRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
44 | 44 |
{ |
45 | 45 |
private static final float FOV = 30.0f; |
46 | 46 |
private static final float NEAR = 0.1f; |
... | ... | |
154 | 154 |
VertexEffectScale.enable(); |
155 | 155 |
FragmentEffectAlpha.enable(); |
156 | 156 |
|
157 |
try
|
|
158 |
{
|
|
159 |
DistortedLibrary.onCreate(act); |
|
160 |
}
|
|
161 |
catch(Exception ex) |
|
162 |
{
|
|
163 |
android.util.Log.e("Inflate", ex.getMessage() );
|
|
164 |
}
|
|
157 |
DistortedLibrary.onCreate(act,this);
|
|
158 |
}
|
|
159 |
|
|
160 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
161 |
|
|
162 |
public void distortedException(Exception ex)
|
|
163 |
{
|
|
164 |
android.util.Log.e("Inflate", ex.getMessage() );
|
|
165 | 165 |
} |
166 | 166 |
} |
src/main/java/org/distorted/examples/listener/ListenerRenderer.java | ||
---|---|---|
48 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
49 | 49 |
// Show how to use the setMax, notifyWhenFinished / effectFinished APIs |
50 | 50 |
|
51 |
class ListenerRenderer implements GLSurfaceView.Renderer,EffectListener
|
|
51 |
class ListenerRenderer implements GLSurfaceView.Renderer, EffectListener, DistortedLibrary.ExceptionListener
|
|
52 | 52 |
{ |
53 | 53 |
private final int NUM_CONCURRENT_BUBBLES = 12; |
54 | 54 |
|
... | ... | |
183 | 183 |
DistortedLibrary.setMax(EffectType.VERTEX,NUM_CONCURRENT_BUBBLES+1); |
184 | 184 |
VertexEffectDistort.enable(); |
185 | 185 |
|
186 |
try
|
|
187 |
{
|
|
188 |
DistortedLibrary.onCreate(mView.getContext()); |
|
189 |
}
|
|
190 |
catch(Exception ex) |
|
191 |
{
|
|
192 |
android.util.Log.e("Listener", ex.getMessage() );
|
|
193 |
}
|
|
186 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
187 |
}
|
|
188 |
|
|
189 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
190 |
|
|
191 |
public void distortedException(Exception ex)
|
|
192 |
{
|
|
193 |
android.util.Log.e("Listener", ex.getMessage() );
|
|
194 | 194 |
} |
195 | 195 |
} |
src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 50 |
|
51 |
class MeshFileRenderer implements GLSurfaceView.Renderer |
|
51 |
class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
52 | 52 |
{ |
53 | 53 |
private GLSurfaceView mView; |
54 | 54 |
private DistortedTexture mTexture; |
... | ... | |
114 | 114 |
{ |
115 | 115 |
if( mTexture==null ) mTexture = new DistortedTexture(); |
116 | 116 |
|
117 |
try
|
|
118 |
{
|
|
119 |
DistortedLibrary.onCreate(mView.getContext()); |
|
120 |
}
|
|
121 |
catch(Exception ex) |
|
122 |
{
|
|
123 |
android.util.Log.e("MeshFile", ex.getMessage() );
|
|
124 |
}
|
|
117 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
118 |
}
|
|
119 |
|
|
120 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
121 |
|
|
122 |
public void distortedException(Exception ex)
|
|
123 |
{
|
|
124 |
android.util.Log.e("MeshFile", ex.getMessage() );
|
|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java | ||
---|---|---|
50 | 50 |
|
51 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 52 |
|
53 |
class MeshJoinRenderer implements GLSurfaceView.Renderer |
|
53 |
class MeshJoinRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
54 | 54 |
{ |
55 | 55 |
private GLSurfaceView mView; |
56 | 56 |
private DistortedTexture mTexture; |
... | ... | |
132 | 132 |
DistortedLibrary.setMax(EffectType.VERTEX, 11); |
133 | 133 |
VertexEffectSink.enable(); |
134 | 134 |
|
135 |
try
|
|
136 |
{
|
|
137 |
DistortedLibrary.onCreate(mView.getContext()); |
|
138 |
}
|
|
139 |
catch(Exception ex) |
|
140 |
{
|
|
141 |
android.util.Log.e("MeshJoin", ex.getMessage() );
|
|
142 |
}
|
|
135 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
136 |
}
|
|
137 |
|
|
138 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
139 |
|
|
140 |
public void distortedException(Exception ex)
|
|
141 |
{
|
|
142 |
android.util.Log.e("MeshJoin", ex.getMessage() );
|
|
143 | 143 |
} |
144 | 144 |
|
145 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/mirror/MirrorRenderer.java | ||
---|---|---|
45 | 45 |
|
46 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 | 47 |
|
48 |
class MirrorRenderer implements GLSurfaceView.Renderer |
|
48 |
class MirrorRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
49 | 49 |
{ |
50 | 50 |
private static final float MIRROR_SCALE =0.70f; // each next mirror will be 70% of the size or the previous |
51 | 51 |
private static final float HEAD_SCALE =0.30f; // Head's height will be 30% of the height of the mirror |
... | ... | |
219 | 219 |
VertexEffectScale.enable(); |
220 | 220 |
FragmentEffectBrightness.enable(); |
221 | 221 |
|
222 |
try
|
|
223 |
{
|
|
224 |
DistortedLibrary.onCreate(mView.getContext()); |
|
225 |
}
|
|
226 |
catch(Exception ex) |
|
227 |
{
|
|
228 |
android.util.Log.e("Mirror", ex.getMessage() );
|
|
229 |
}
|
|
222 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
223 |
}
|
|
224 |
|
|
225 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
226 |
|
|
227 |
public void distortedException(Exception ex)
|
|
228 |
{
|
|
229 |
android.util.Log.e("Mirror", ex.getMessage() );
|
|
230 | 230 |
} |
231 | 231 |
} |
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 45 |
|
46 |
class MonaLisaRenderer implements GLSurfaceView.Renderer
|
|
46 |
class MonaLisaRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
47 | 47 |
{ |
48 | 48 |
private GLSurfaceView mView; |
49 | 49 |
private DistortedEffects mEffects; |
... | ... | |
161 | 161 |
// before the call to DistortedLibrary.onCreate(). Best done here. |
162 | 162 |
VertexEffectDistort.enable(); |
163 | 163 |
|
164 |
try
|
|
165 |
{
|
|
166 |
DistortedLibrary.onCreate(mView.getContext()); |
|
167 |
}
|
|
168 |
catch(Exception ex) |
|
169 |
{
|
|
170 |
android.util.Log.e("MonaLisa", ex.getMessage() );
|
|
171 |
}
|
|
164 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
165 |
}
|
|
166 |
|
|
167 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
168 |
|
|
169 |
public void distortedException(Exception ex)
|
|
170 |
{
|
|
171 |
android.util.Log.e("MonaLisa", ex.getMessage() );
|
|
172 | 172 |
} |
173 | 173 |
} |
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 |
} |
src/main/java/org/distorted/examples/movingglow/MovingGlowRenderer.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
54 | 54 |
|
55 |
class MovingGlowRenderer implements GLSurfaceView.Renderer,EffectListener
|
|
55 |
class MovingGlowRenderer implements GLSurfaceView.Renderer, EffectListener, DistortedLibrary.ExceptionListener
|
|
56 | 56 |
{ |
57 | 57 |
private static final int[] colors = new int[] {0,0,1, 1,0,1, 1,0,0, 1,1,0, 0,1,0, 1,1,1}; // blue, pink, red, yellow, green, white |
58 | 58 |
private static final int FLASH_TIME = 2000; |
... | ... | |
194 | 194 |
FragmentEffectChroma.enable(); |
195 | 195 |
PostprocessEffectGlow.enable(); |
196 | 196 |
|
197 |
try |
|
198 |
{ |
|
199 |
DistortedLibrary.onCreate(mView.getContext()); |
|
200 |
} |
|
201 |
catch(Exception ex) |
|
202 |
{ |
|
203 |
android.util.Log.e("MovingGlow", ex.getMessage() ); |
|
204 |
} |
|
197 |
DistortedLibrary.onCreate(mView.getContext(), this); |
|
205 | 198 |
} |
199 |
|
|
200 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
201 |
|
|
202 |
public void distortedException(Exception ex) |
|
203 |
{ |
|
204 |
android.util.Log.e("MovingGlow", ex.getMessage() ); |
|
205 |
} |
|
206 | 206 |
} |
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
49 | 49 |
|
50 |
class MultiblurRenderer implements GLSurfaceView.Renderer |
|
50 |
class MultiblurRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
51 | 51 |
{ |
52 | 52 |
private static final int[] MOVE_VEC = |
53 | 53 |
{ |
... | ... | |
196 | 196 |
|
197 | 197 |
PostprocessEffectBlur.enable(); |
198 | 198 |
|
199 |
try
|
|
200 |
{
|
|
201 |
DistortedLibrary.onCreate(mView.getContext()); |
|
202 |
}
|
|
203 |
catch(Exception ex) |
|
204 |
{
|
|
205 |
android.util.Log.e("Multiblur", ex.getMessage() );
|
|
206 |
}
|
|
199 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
200 |
}
|
|
201 |
|
|
202 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
203 |
|
|
204 |
public void distortedException(Exception ex)
|
|
205 |
{
|
|
206 |
android.util.Log.e("Multiblur", ex.getMessage() );
|
|
207 | 207 |
} |
208 | 208 |
|
209 | 209 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/objecttree/ObjectTreeRenderer.java | ||
---|---|---|
54 | 54 |
|
55 | 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
56 | 56 |
|
57 |
class ObjectTreeRenderer implements GLSurfaceView.Renderer |
|
57 |
class ObjectTreeRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
58 | 58 |
{ |
59 | 59 |
private static final int NODE_FBO_SIZE = 300; |
60 | 60 |
private static final int GRID = 10; |
... | ... | |
201 | 201 |
VertexEffectSink.enable(); |
202 | 202 |
FragmentEffectChroma.enable(); |
203 | 203 |
|
204 |
try
|
|
205 |
{
|
|
206 |
DistortedLibrary.onCreate(mView.getContext()); |
|
207 |
}
|
|
208 |
catch(Exception ex) |
|
209 |
{
|
|
210 |
android.util.Log.e("ObjectTree", ex.getMessage() );
|
|
211 |
}
|
|
204 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
205 |
}
|
|
206 |
|
|
207 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
208 |
|
|
209 |
public void distortedException(Exception ex)
|
|
210 |
{
|
|
211 |
android.util.Log.e("ObjectTree", ex.getMessage() );
|
|
212 | 212 |
} |
213 | 213 |
} |
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
49 | 49 |
|
50 |
class OlimpicRenderer implements GLSurfaceView.Renderer
|
|
50 |
class OlimpicRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
51 | 51 |
{ |
52 | 52 |
private static final int LEAF_SIZE = 100; |
53 | 53 |
private static final int NUM_CIRCLES = 5; |
... | ... | |
207 | 207 |
|
208 | 208 |
FragmentEffectChroma.enable(); |
209 | 209 |
|
210 |
try
|
|
211 |
{
|
|
212 |
DistortedLibrary.onCreate(mView.getContext()); |
|
213 |
}
|
|
214 |
catch(Exception ex) |
|
215 |
{
|
|
216 |
android.util.Log.e("Olympic", ex.getMessage() );
|
|
217 |
}
|
|
210 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
211 |
}
|
|
212 |
|
|
213 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
214 |
|
|
215 |
public void distortedException(Exception ex)
|
|
216 |
{
|
|
217 |
android.util.Log.e("Olympic", ex.getMessage() );
|
|
218 | 218 |
} |
219 | 219 |
} |
src/main/java/org/distorted/examples/postprocesstree/PostprocessTreeRenderer.java | ||
---|---|---|
49 | 49 |
|
50 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
51 | 51 |
|
52 |
class PostprocessTreeRenderer implements GLSurfaceView.Renderer |
|
52 |
class PostprocessTreeRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
53 | 53 |
{ |
54 | 54 |
private static final int LEAF_SIZE = 100; |
55 | 55 |
private static final int NUM_LEAVES = 8; |
... | ... | |
185 | 185 |
FragmentEffectChroma.enable(); |
186 | 186 |
PostprocessEffectBlur.enable(); |
187 | 187 |
|
188 |
try
|
|
189 |
{
|
|
190 |
DistortedLibrary.onCreate(mView.getContext()); |
|
191 |
}
|
|
192 |
catch(Exception ex) |
|
193 |
{
|
|
194 |
android.util.Log.e("PostprocessTree", ex.getMessage() );
|
|
195 |
}
|
|
188 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
189 |
}
|
|
190 |
|
|
191 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
192 |
|
|
193 |
public void distortedException(Exception ex)
|
|
194 |
{
|
|
195 |
android.util.Log.e("PostprocessTree", ex.getMessage() );
|
|
196 | 196 |
} |
197 | 197 |
} |
src/main/java/org/distorted/examples/predeform/PredeformRenderer.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 45 |
|
46 |
class PredeformRenderer implements GLSurfaceView.Renderer |
|
46 |
class PredeformRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
47 | 47 |
{ |
48 | 48 |
private static final float FOV = 30.0f; |
49 | 49 |
private static final float NEAR = 0.1f; |
... | ... | |
180 | 180 |
|
181 | 181 |
Effect.enableEffects(EffectType.VERTEX); |
182 | 182 |
|
183 |
try
|
|
184 |
{
|
|
185 |
DistortedLibrary.onCreate(act); |
|
186 |
}
|
|
187 |
catch(Exception ex) |
|
188 |
{
|
|
189 |
android.util.Log.e("Inflate", ex.getMessage() );
|
|
190 |
}
|
|
183 |
DistortedLibrary.onCreate(act, this);
|
|
184 |
}
|
|
185 |
|
|
186 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
187 |
|
|
188 |
public void distortedException(Exception ex)
|
|
189 |
{
|
|
190 |
android.util.Log.e("Predeform", ex.getMessage() );
|
|
191 | 191 |
} |
192 | 192 |
} |
src/main/java/org/distorted/examples/projection/ProjectionRenderer.java | ||
---|---|---|
41 | 41 |
|
42 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 | 43 |
|
44 |
class ProjectionRenderer implements GLSurfaceView.Renderer |
|
44 |
class ProjectionRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
45 | 45 |
{ |
46 | 46 |
private GLSurfaceView mView; |
47 | 47 |
private DistortedEffects mEffects; |
... | ... | |
146 | 146 |
{ |
147 | 147 |
VertexEffectDeform.enable(); |
148 | 148 |
|
149 |
try
|
|
150 |
{
|
|
151 |
DistortedLibrary.onCreate(mView.getContext()); |
|
152 |
}
|
|
153 |
catch(Exception ex) |
|
154 |
{
|
|
155 |
android.util.Log.e("Projection", ex.getMessage() );
|
|
156 |
}
|
|
149 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
150 |
}
|
|
151 |
|
|
152 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
153 |
|
|
154 |
public void distortedException(Exception ex)
|
|
155 |
{
|
|
156 |
android.util.Log.e("Projection", ex.getMessage() );
|
|
157 | 157 |
} |
158 | 158 |
} |
src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 48 |
|
49 |
class QuaternionRenderer implements GLSurfaceView.Renderer
|
|
49 |
class QuaternionRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
50 | 50 |
{ |
51 | 51 |
private static final int NUM_QUATERNIONS = 5; |
52 | 52 |
|
... | ... | |
104 | 104 |
|
105 | 105 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
106 | 106 |
{ |
107 |
float factor = 0.5f*(width>height ? height:width);
|
|
107 |
float factor = 0.5f*Math.min(width,height);
|
|
108 | 108 |
|
109 | 109 |
mScale.set(factor,factor,factor); |
110 | 110 |
mScreen.resize(width, height); |
... | ... | |
131 | 131 |
} |
132 | 132 |
|
133 | 133 |
mTexture.setTexture(bitmap); |
134 |
|
|
135 |
try
|
|
136 |
{
|
|
137 |
DistortedLibrary.onCreate(mView.getContext()); |
|
138 |
}
|
|
139 |
catch(Exception ex) |
|
140 |
{
|
|
141 |
android.util.Log.e("Quaternion", ex.getMessage() );
|
|
142 |
}
|
|
134 |
|
|
135 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
136 |
}
|
|
137 |
|
|
138 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
139 |
|
|
140 |
public void distortedException(Exception ex)
|
|
141 |
{
|
|
142 |
android.util.Log.e("Quaternion", ex.getMessage() );
|
|
143 | 143 |
} |
144 | 144 |
} |
src/main/java/org/distorted/examples/rubik/RubikRenderer.java | ||
---|---|---|
32 | 32 |
|
33 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 34 |
|
35 |
class RubikRenderer implements GLSurfaceView.Renderer, EffectListener |
|
35 |
class RubikRenderer implements GLSurfaceView.Renderer, EffectListener, DistortedLibrary.ExceptionListener
|
|
36 | 36 |
{ |
37 | 37 |
private static final float CUBE_SCREEN_RATIO = 0.5f; |
38 | 38 |
private static final float CAMERA_DISTANCE = 0.6f; // 0.6 of the length of max(scrHeight,scrWidth) |
... | ... | |
111 | 111 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
112 | 112 |
{ |
113 | 113 |
createNextCube(); |
114 |
|
|
115 | 114 |
VertexEffectSink.enable(); |
115 |
DistortedLibrary.onCreate(mView.getContext(), this); |
|
116 |
} |
|
116 | 117 |
|
117 |
try |
|
118 |
{ |
|
119 |
DistortedLibrary.onCreate(mView.getContext()); |
|
120 |
} |
|
121 |
catch(Exception ex) |
|
122 |
{ |
|
123 |
android.util.Log.e("Rubik", ex.getMessage() ); |
|
124 |
} |
|
118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
119 |
|
|
120 |
public void distortedException(Exception ex) |
|
121 |
{ |
|
122 |
android.util.Log.e("Rubik", ex.getMessage() ); |
|
125 | 123 |
} |
126 | 124 |
|
127 | 125 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/save/SaveRenderer.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
54 | 54 |
|
55 |
class SaveRenderer implements GLSurfaceView.Renderer |
|
55 |
class SaveRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
56 | 56 |
{ |
57 | 57 |
private GLSurfaceView mView; |
58 | 58 |
private DistortedEffects mEffects; |
... | ... | |
249 | 249 |
VertexEffectScale.enable(); |
250 | 250 |
VertexEffectSink.enable(); |
251 | 251 |
|
252 |
try
|
|
253 |
{
|
|
254 |
DistortedLibrary.onCreate(mView.getContext()); |
|
255 |
}
|
|
256 |
catch(Exception ex) |
|
257 |
{
|
|
258 |
android.util.Log.e("Renderer", ex.getMessage() );
|
|
259 |
}
|
|
252 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
253 |
}
|
|
254 |
|
|
255 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
256 |
|
|
257 |
public void distortedException(Exception ex)
|
|
258 |
{
|
|
259 |
android.util.Log.e("Save", ex.getMessage() );
|
|
260 | 260 |
} |
261 | 261 |
} |
src/main/java/org/distorted/examples/singlemesh/SingleMeshRenderer.java | ||
---|---|---|
50 | 50 |
|
51 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 52 |
|
53 |
class SingleMeshRenderer implements GLSurfaceView.Renderer |
|
53 |
class SingleMeshRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
54 | 54 |
{ |
55 | 55 |
private static final float DIST = 0.5f; |
56 | 56 |
|
... | ... | |
185 | 185 |
DistortedLibrary.setMax(EffectType.VERTEX, 15); |
186 | 186 |
VertexEffectRotate.enable(); |
187 | 187 |
|
188 |
try
|
|
189 |
{
|
|
190 |
DistortedLibrary.onCreate(mView.getContext()); |
|
191 |
}
|
|
192 |
catch(Exception ex) |
|
193 |
{
|
|
194 |
android.util.Log.e("DeferredJob", ex.getMessage() );
|
|
195 |
}
|
|
188 |
DistortedLibrary.onCreate(mView.getContext(), this);
|
|
189 |
}
|
|
190 |
|
|
191 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
192 |
|
|
193 |
public void distortedException(Exception ex)
|
|
194 |
{
|
|
195 |
android.util.Log.e("SingleMesh", ex.getMessage() );
|
|
196 | 196 |
} |
197 | 197 |
|
198 | 198 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/sink/SinkRenderer.java | ||
---|---|---|
45 | 45 |
|
46 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 | 47 |
|
48 |
class SinkRenderer implements GLSurfaceView.Renderer
|
|
48 |
class SinkRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
49 | 49 |
{ |
50 | 50 |
private GLSurfaceView mView; |
51 | 51 |
private DistortedEffects mEffects; |
... | ... | |
125 | 125 |
mScreen.attach(mTexture,mEffects,mMesh); |
126 | 126 |
|
127 | 127 |
VertexEffectSink.enable(); |
128 |
DistortedLibrary.onCreate(mView.getContext(), this); |
|
129 |
} |
|
128 | 130 |
|
129 |
try |
|
130 |
{ |
|
131 |
DistortedLibrary.onCreate(mView.getContext()); |
|
132 |
} |
|
133 |
catch(Exception ex) |
|
134 |
{ |
|
135 |
android.util.Log.e("Sink", ex.getMessage() ); |
|
136 |
} |
|
131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
132 |
|
|
133 |
public void distortedException(Exception ex) |
|
134 |
{ |
|
135 |
android.util.Log.e("Sink", ex.getMessage() ); |
|
137 | 136 |
} |
138 | 137 |
} |
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java | ||
---|---|---|
54 | 54 |
|
55 | 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
56 | 56 |
|
57 |
class StarWarsRenderer implements GLSurfaceView.Renderer, EffectListener |
|
57 |
class StarWarsRenderer implements GLSurfaceView.Renderer, EffectListener, DistortedLibrary.ExceptionListener
|
|
58 | 58 |
{ |
59 | 59 |
private final String[] mGFFAString = |
60 | 60 |
|
... | ... | |
186 | 186 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
187 | 187 |
{ |
188 | 188 |
setupBitmaps(); |
189 |
|
|
190 | 189 |
FragmentEffectAlpha.enable(); |
190 |
DistortedLibrary.onCreate(mView.getContext(), this); |
|
191 |
} |
|
191 | 192 |
|
192 |
try |
|
193 |
{ |
|
194 |
DistortedLibrary.onCreate(mView.getContext()); |
|
195 |
} |
|
196 |
catch(Exception ex) |
|
197 |
{ |
|
198 |
android.util.Log.e("Star Wars", ex.getMessage() ); |
|
199 |
} |
|
193 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
194 |
|
|
195 |
public void distortedException(Exception ex) |
Also available in: Unified diff
Only compile the Full, Normal & OIT programs when they are actually needed.