Revision 30beb34f
Added by Leszek Koltunski over 8 years ago
| src/main/java/org/distorted/library/Distorted.java | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
package org.distorted.library; |
| 21 | 21 |
|
| 22 |
import android.app.ActivityManager; |
|
| 22 | 23 |
import android.content.Context; |
| 24 |
import android.content.pm.ConfigurationInfo; |
|
| 23 | 25 |
import android.content.res.Resources; |
| 24 | 26 |
import org.distorted.library.program.*; |
| 25 | 27 |
|
| ... | ... | |
| 106 | 108 |
public static void onCreate(final Context context) |
| 107 | 109 |
throws FragmentCompilationException,VertexCompilationException,VertexUniformsException,FragmentUniformsException,LinkingException |
| 108 | 110 |
{
|
| 109 |
GLSL = 100; |
|
| 111 |
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
|
| 112 |
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); |
|
| 113 |
android.util.Log.e("DISTORTED", "Using OpenGL ES "+configurationInfo.getGlEsVersion());
|
|
| 114 |
|
|
| 115 |
GLSL = ( (configurationInfo.reqGlEsVersion>>16)>=3 ? 300 : 100 ); |
|
| 110 | 116 |
GLSL_VERSION= (GLSL==100 ? "#version 100\n" : "#version 300 es\n"); |
| 111 | 117 |
|
| 112 | 118 |
final Resources resources = context.getResources(); |
Also available in: Unified diff
It now automatically chooses OpenGL ES 2.0 and GLSL 100 or OpenGL ES 3.0 and GLSL 300.
Postprocessing effects will not work on OpenGL ES 2.0 contexts.