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