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