Revision 061449ed
Added by Leszek Koltunski almost 4 years ago
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 |
} |
Also available in: Unified diff
Only compile the Full, Normal & OIT programs when they are actually needed.