Revision 9519d1b1
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/main/DistortedLibrary.java | ||
---|---|---|
950 | 950 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
951 | 951 |
/** |
952 | 952 |
* When OpenGL context gets created, call this method so that the library can initialise its internal data structures. |
953 |
* I.e. best called from GLSurfaceView.onCreate().
|
|
953 |
* I.e. best called from GLSurfaceView.Renderer.onSurfaceCreated().
|
|
954 | 954 |
* <p> |
955 | 955 |
* Needs to be called from a thread holding the OpenGL context. |
956 | 956 |
* |
957 | 957 |
* @param context Context of the App using the library - used to open up Resources and read Shader code. |
958 | 958 |
* @param listener The library will send all (asynchronous!) exceptions there. |
959 | 959 |
*/ |
960 |
public static void onCreate(final Context context, final ExceptionListener listener)
|
|
960 |
public static void onSurfaceCreated(final Context context, final ExceptionListener listener)
|
|
961 | 961 |
{ |
962 |
onCreate(context,listener,4);
|
|
962 |
onSurfaceCreated(context,listener,4);
|
|
963 | 963 |
} |
964 | 964 |
|
965 | 965 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
966 | 966 |
/** |
967 | 967 |
* When OpenGL context gets created, call this method so that the library can initialise its internal data structures. |
968 |
* I.e. best called from GLSurfaceView.onCreate().
|
|
968 |
* I.e. best called from GLSurfaceView.Renderer.onSurfaceCreated().
|
|
969 | 969 |
* <p> |
970 | 970 |
* Needs to be called from a thread holding the OpenGL context. |
971 | 971 |
* |
972 | 972 |
* @param context Context of the App using the library - used to open up Resources and read Shader code. |
973 | 973 |
* @param listener The library will send all (asynchronous!) exceptions there. |
974 |
* @param queueSize the size of the FBO queue, a workaround for the bug on Mali drivers. |
|
974 |
* @param queueSize the size of the FBO queue, a workaround for the bug on Mali drivers. Use a small integer - 1,...,4
|
|
975 | 975 |
*/ |
976 |
public static void onCreate(final Context context, final ExceptionListener listener, int queueSize)
|
|
976 |
public static void onSurfaceCreated(final Context context, final ExceptionListener listener, int queueSize)
|
|
977 | 977 |
{ |
978 | 978 |
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
979 | 979 |
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); |
... | ... | |
1006 | 1006 |
mOITCompilationAttempted = false; |
1007 | 1007 |
|
1008 | 1008 |
detectBuggyDriversAndSetQueueSize(queueSize); |
1009 |
|
|
1010 | 1009 |
EffectMessageSender.startSending(); |
1011 | 1010 |
|
1012 | 1011 |
mResources = context.getResources(); |
... | ... | |
1118 | 1117 |
* <ul> |
1119 | 1118 |
* <li>the value of 'max' is outside permitted range (0 ≤ max ≤ Byte.MAX_VALUE) |
1120 | 1119 |
* <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called |
1121 |
* before the Vertex Shader gets compiled, i.e. before the call to {@link DistortedLibrary#onCreate}. After this
|
|
1120 |
* before the Vertex Shader gets compiled, i.e. before the call to {@link DistortedLibrary#onSurfaceCreated}. After this
|
|
1122 | 1121 |
* time only decreasing the value of 'max' is permitted. |
1123 | 1122 |
* <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created. |
1124 | 1123 |
* </ul> |
Also available in: Unified diff
1) Beginnings of support for using the library from more than one activity
2) rename DistortedLibrary.onCreate() to onSurfaceCreated()
3) (rubik) add Cambodia's flag.