Revision 061449ed
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/examples/transparency/TransparencyRenderer.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 45 |
|
46 |
class TransparencyRenderer implements GLSurfaceView.Renderer |
|
46 |
class TransparencyRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
|
47 | 47 |
{ |
48 | 48 |
private static final int NUM = 4; // 4 ints (x,y,z, argb) each describe 1 object below |
49 | 49 |
|
... | ... | |
185 | 185 |
mScreen.render(System.currentTimeMillis()); |
186 | 186 |
} |
187 | 187 |
|
188 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
189 |
|
|
190 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
|
191 |
{ |
|
192 |
float size= 0.02f*OBJ_SIZE; |
|
193 |
mScreenMin = Math.min(width, height); |
|
194 |
|
|
195 |
float factor = 0.65f*mScreenMin/OBJ_SIZE; |
|
196 |
mScale.set(factor,factor,factor); |
|
197 |
|
|
198 |
for(int i=0; i<NUM_OBJECTS; i++) |
|
199 |
{ |
|
200 |
mMoveVector[i].set(size*OBJECTS[NUM*i], size*OBJECTS[NUM*i+1], size*OBJECTS[NUM*i+2]); |
|
201 |
} |
|
202 |
|
|
203 |
mScreen.resize(width, height); |
|
204 |
} |
|
205 |
|
|
188 | 206 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
189 | 207 |
|
190 | 208 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
... | ... | |
197 | 215 |
VertexEffectScale.enable(); |
198 | 216 |
PostprocessEffectBlur.enable(); |
199 | 217 |
FragmentEffectAlpha.enable(); |
200 |
|
|
201 |
try |
|
202 |
{ |
|
203 |
DistortedLibrary.onCreate(mView.getContext()); |
|
204 |
} |
|
205 |
catch(Exception ex) |
|
206 |
{ |
|
207 |
android.util.Log.e("Transparency", ex.getMessage() ); |
|
208 |
} |
|
218 |
DistortedLibrary.onCreate(mView.getContext(), this); |
|
209 | 219 |
} |
210 | 220 |
|
211 | 221 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
212 | 222 |
|
213 |
public void onSurfaceChanged(GL10 glUnused, int width, int height)
|
|
223 |
public void distortedException(Exception ex)
|
|
214 | 224 |
{ |
215 |
float size= 0.02f*OBJ_SIZE; |
|
216 |
mScreenMin = Math.min(width, height); |
|
217 |
|
|
218 |
float factor = 0.65f*mScreenMin/OBJ_SIZE; |
|
219 |
mScale.set(factor,factor,factor); |
|
220 |
|
|
221 |
for(int i=0; i<NUM_OBJECTS; i++) |
|
222 |
{ |
|
223 |
mMoveVector[i].set(size*OBJECTS[NUM*i], size*OBJECTS[NUM*i+1], size*OBJECTS[NUM*i+2]); |
|
224 |
} |
|
225 |
|
|
226 |
mScreen.resize(width, height); |
|
225 |
android.util.Log.e("Transparency", ex.getMessage() ); |
|
227 | 226 |
} |
228 | 227 |
} |
Also available in: Unified diff
Only compile the Full, Normal & OIT programs when they are actually needed.