Revision 040cd18c
Added by Leszek Koltunski almost 6 years ago
src/main/java/org/distorted/library/main/Distorted.java | ||
---|---|---|
28 | 28 |
import org.distorted.library.effect.FragmentEffect; |
29 | 29 |
import org.distorted.library.effect.PostprocessEffect; |
30 | 30 |
import org.distorted.library.effect.VertexEffect; |
31 |
import org.distorted.library.program.*; |
|
32 | 31 |
|
33 | 32 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 33 |
/** |
... | ... | |
106 | 105 |
* Needs to be called from a thread holding the OpenGL context. |
107 | 106 |
* |
108 | 107 |
* @param context Context of the App using the library - used to open up Resources and read Shader code. |
109 |
* @throws FragmentCompilationException Fragment Shader failed to compile |
|
110 |
* @throws VertexCompilationException Vertex Shader failed to compile |
|
111 |
* @throws VertexUniformsException Too many uniforms in the Vertex Shader |
|
112 |
* @throws FragmentUniformsException Too many uniforms in the Fragment Shader |
|
113 |
* @throws LinkingException Shader failed to link |
|
114 | 108 |
*/ |
115 | 109 |
public static void onCreate(final Context context) |
116 |
throws FragmentCompilationException,VertexCompilationException,VertexUniformsException,FragmentUniformsException,LinkingException |
|
117 | 110 |
{ |
118 | 111 |
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
119 | 112 |
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); |
120 | 113 |
android.util.Log.e("DISTORTED", "Using OpenGL ES "+configurationInfo.getGlEsVersion()); |
121 | 114 |
|
122 |
GLSL = ( (configurationInfo.reqGlEsVersion>>16)>=3 ? 300 : 100 );
|
|
123 |
GLSL_VERSION= (GLSL==100 ? "#version 100\n" : "#version 300 es\n");
|
|
115 |
GLSL = ( (configurationInfo.reqGlEsVersion>>16)>=3 ? 310 : 100 );
|
|
116 |
GLSL_VERSION= (GLSL==100 ? "#version 100\n" : "#version 310 es\n");
|
|
124 | 117 |
|
125 | 118 |
EffectMessageSender.startSending(); |
126 | 119 |
|
... | ... | |
133 | 126 |
|
134 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
135 | 128 |
/** |
136 |
* Call this so that the Library can release its internal data structures. |
|
129 |
* Call this so that the Library can mark OpenGL objects that would need to be recreated when we |
|
130 |
* get resumed. |
|
137 | 131 |
* Must be called from Activity.onPause(). |
138 | 132 |
*/ |
139 | 133 |
public static void onPause() |
... | ... | |
162 | 156 |
|
163 | 157 |
mInitialized = false; |
164 | 158 |
} |
165 |
|
|
166 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
167 |
/** |
|
168 |
* Return 2 or 3 depending if we have OpenGL Es 2.0 or 3.x context created. |
|
169 |
*/ |
|
170 |
public static int getGlVersion() |
|
171 |
{ |
|
172 |
return GLSL == 300 ? 3:2; |
|
173 |
} |
|
174 | 159 |
} |
Also available in: Unified diff
Port all the 'non-controversial' changes from order-independent-transparency branch.