1 |
29fdea14
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2016 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Distorted. //
|
5 |
|
|
// //
|
6 |
|
|
// Distorted is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Distorted is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
|
|
package org.distorted.examples.flatblur2;
|
21 |
|
|
|
22 |
|
|
import android.opengl.GLSurfaceView;
|
23 |
|
|
|
24 |
|
|
import org.distorted.library.main.DistortedLibrary;
|
25 |
|
|
import org.distorted.library.main.DistortedScreen;
|
26 |
|
|
|
27 |
|
|
import javax.microedition.khronos.egl.EGLConfig;
|
28 |
|
|
import javax.microedition.khronos.opengles.GL10;
|
29 |
|
|
|
30 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
31 |
|
|
|
32 |
|
|
class FlatBlur2Renderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
|
33 |
|
|
{
|
34 |
|
|
private final GLSurfaceView mView;
|
35 |
|
|
private final DistortedScreen mScreen;
|
36 |
|
|
|
37 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
38 |
|
|
|
39 |
|
|
FlatBlur2Renderer(GLSurfaceView v)
|
40 |
|
|
{
|
41 |
|
|
mView = v;
|
42 |
|
|
mScreen = new DistortedScreen();
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
46 |
|
|
|
47 |
|
|
public void onDrawFrame(GL10 glUnused)
|
48 |
|
|
{
|
49 |
|
|
mScreen.render(System.currentTimeMillis());
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
53 |
|
|
|
54 |
|
|
public void onSurfaceChanged(GL10 glUnused, int width, int height)
|
55 |
|
|
{
|
56 |
|
|
mScreen.resize(width,height);
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
60 |
|
|
|
61 |
|
|
public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
|
62 |
|
|
{
|
63 |
|
|
OverlayStars.enableEffects();
|
64 |
|
|
DistortedLibrary.onSurfaceCreated( mView.getContext(), this);
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
68 |
|
|
|
69 |
|
|
public void distortedException(Exception ex)
|
70 |
|
|
{
|
71 |
|
|
android.util.Log.e("FlatBlur2", ex.getMessage() );
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
75 |
|
|
|
76 |
|
|
public void button1()
|
77 |
|
|
{
|
78 |
|
|
OverlayStars stars = new OverlayStars();
|
79 |
|
|
stars.startOverlay(mScreen);
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
83 |
|
|
|
84 |
|
|
public void button2()
|
85 |
|
|
{
|
86 |
|
|
|
87 |
|
|
}
|
88 |
|
|
}
|