Project

General

Profile

« Previous | Next » 

Revision 8c57d77b

Added by Leszek Koltunski over 1 year ago

Decouple (to a large degree) the OpenGL Library from Android.

View differences:

src/main/java/org/distorted/library/effect/Effect.java
21 21
package org.distorted.library.effect;
22 22

  
23 23
import org.distorted.library.effectqueue.EffectQueue;
24
import org.distorted.library.main.DistortedLibrary;
24 25
import org.distorted.library.main.InternalStackFrameList;
25 26
import org.distorted.library.message.EffectListener;
26 27

  
......
206 207
          }
207 208
        catch(NoSuchMethodException ex)
208 209
          {
209
          android.util.Log.e("Effect", "exception getting method: "+ex.getMessage());
210
          DistortedLibrary.logMessage("Effect: exception getting method: "+ex.getMessage());
210 211
          method = null;
211 212
          }
212 213

  
......
216 217
          }
217 218
        catch(Exception ex)
218 219
          {
219
          android.util.Log.e("Effect", "exception invoking method: "+ex.getMessage());
220
          DistortedLibrary.logMessage("Effect: exception invoking method: "+ex.getMessage());
220 221
          }
221 222
        }
222 223
      }
src/main/java/org/distorted/library/effect/PostprocessEffect.java
22 22

  
23 23
import org.distorted.library.effectqueue.EffectQueue;
24 24
import org.distorted.library.main.DistortedFramebuffer;
25
import org.distorted.library.main.DistortedLibrary;
25 26
import org.distorted.library.main.InternalMaster;
26 27
import org.distorted.library.program.DistortedProgram;
27 28

  
......
135 136
        }
136 137
      catch(Exception e)
137 138
        {
138
        android.util.Log.e("Effects", "exception trying to compile "+source.mName+" program: "+e.getMessage());
139
        DistortedLibrary.logMessage("PostproocessEffect: exception trying to compile "+source.mName+" program: "+e.getMessage());
139 140
        throw new RuntimeException(e.getMessage());
140 141
        }
141 142
      }
......
259 260
          }
260 261
        catch(NoSuchMethodException ex)
261 262
          {
262
          android.util.Log.e("postprocess", cls.getSimpleName()+": exception getting method: "+ex.getMessage());
263
          DistortedLibrary.logMessage("PostprocessEffect: "+cls.getSimpleName()+": exception getting method: "+ex.getMessage());
263 264
          method = null;
264 265
          }
265 266

  
......
269 270
          }
270 271
        catch(Exception ex)
271 272
          {
272
          android.util.Log.e("postprocess", "exception invoking method: "+ex.getMessage());
273
          DistortedLibrary.logMessage("PostprocessEffect: exception invoking method: "+ex.getMessage());
273 274
          }
274 275
        }
275 276
      }
src/main/java/org/distorted/library/effect/VertexEffect.java
21 21
package org.distorted.library.effect;
22 22

  
23 23
import org.distorted.library.effectqueue.EffectQueue;
24
import org.distorted.library.main.DistortedLibrary;
24 25
import org.distorted.library.type.Static1D;
25 26
import org.distorted.library.type.Static3D;
26 27
import org.distorted.library.type.Static4D;
......
97 98
          }
98 99
        catch(NoSuchMethodException ex)
99 100
          {
100
          android.util.Log.e("Effect", "exception getting method: "+ex.getMessage());
101
          DistortedLibrary.logMessage("VertexEffect: exception getting method: "+ex.getMessage());
101 102
          method = null;
102 103
          }
103 104

  
......
113 114
          }
114 115
        catch(Exception ex)
115 116
          {
116
          android.util.Log.e("Effect", "exception invoking method: "+ex.getMessage());
117
          DistortedLibrary.logMessage("VertexEffect: exception invoking method: "+ex.getMessage());
117 118
          }
118 119
        }
119 120
      }
src/main/java/org/distorted/library/effectqueue/EffectQueue.java
405 405
      }
406 406
    else
407 407
      {
408
      android.util.Log.e("queue", "getEffect: out of range "+position);
408
      DistortedLibrary.logMessage("EffectQueue: getEffect: out of range "+position);
409 409
      return null;
410 410
      }
411 411
    }
......
490 490
                       }
491 491
                     else
492 492
                       {
493
                       android.util.Log.e("queue", "failed to add effect "+job.effect.getName());
493
                       DistortedLibrary.logMessage("EffectQueue: failed to add effect "+job.effect.getName());
494 494
                       }
495 495
                     break;
496 496
        case DETACH: for(int j=0; j<mNumEffects; j++)
src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.java
20 20

  
21 21
package org.distorted.library.effectqueue;
22 22

  
23
import android.content.res.Resources;
24 23
import android.opengl.GLES30;
25
import android.util.Log;
26 24

  
27
import org.distorted.library.R;
28 25
import org.distorted.library.effect.EffectType;
29 26
import org.distorted.library.effect.PostprocessEffect;
30 27
import org.distorted.library.effect.VertexEffect;
......
74 71
  EffectQueuePostprocess(EffectQueuePostprocess source)
75 72
    {
76 73
    super(source);
74

  
75
    mHalo = source.mHalo;
76
    mUseHaloDepth = source.mUseHaloDepth;
77
    mR = source.mR;
78
    mG = source.mG;
79
    mB = source.mB;
80
    mA = source.mA;
77 81
    }
78 82

  
79 83
///////////////////////////////////////////////////////////////////////////////////////////////////
......
118 122

  
119 123
///////////////////////////////////////////////////////////////////////////////////////////////////
120 124

  
121
  public static void createPrograms(Resources resources, int GLSL)
125
  public static void createPrograms(InputStream vert, InputStream frag, int GLSL)
122 126
    {
123
    final InputStream mainVertStream = resources.openRawResource(R.raw.main_vertex_shader);
124
    final InputStream mainFragStream = resources.openRawResource(R.raw.preprocess_fragment_shader);
125

  
126 127
    int numV = VertexEffect.getNumEnabled();
127 128

  
128 129
    String version = "#version "+GLSL+" es\n";
......
136 137

  
137 138
    try
138 139
      {
139
      mPreProgram = new DistortedProgram(mainVertStream, mainFragStream, mainVertHeader, mainFragHeader,
140
      mPreProgram = new DistortedProgram(vert, frag, mainVertHeader, mainFragHeader,
140 141
                                         enabledEffectV, null, GLSL, null);
141 142
      }
142 143
    catch(Exception e)
143 144
      {
144
      Log.e("POSTPROCESS", e.getClass().getSimpleName()+" trying to compile PRE program: "+e.getMessage());
145
      DistortedLibrary.logMessage("EffectQueuePostprocess "+ e.getClass().getSimpleName()+" trying to compile PRE program: "+e.getMessage());
145 146
      throw new RuntimeException(e.getMessage());
146 147
      }
147 148

  
src/main/java/org/distorted/library/main/DistortedFramebuffer.java
21 21
package org.distorted.library.main;
22 22

  
23 23
import android.opengl.GLES30;
24
import android.util.Log;
25 24

  
26 25
///////////////////////////////////////////////////////////////////////////////////////////////////
27 26
/**
......
154 153

  
155 154
    if(status != GLES30.GL_FRAMEBUFFER_COMPLETE)
156 155
      {
157
      Log.e("DistortedFramebuffer", "FRAMEBUFFER INCOMPLETE, "+message+" error="+status);
156
      DistortedLibrary.logMessage("DistortedFramebuffer: FRAMEBUFFER INCOMPLETE, "+message+" error="+status);
158 157

  
159 158
      GLES30.glDeleteTextures(1, mColorH, 0);
160 159
      GLES30.glDeleteTextures(1, mDepthStencilH, 0);
src/main/java/org/distorted/library/main/DistortedLibrary.java
20 20

  
21 21
package org.distorted.library.main;
22 22

  
23
import android.app.ActivityManager;
24
import android.content.Context;
25
import android.content.pm.ConfigurationInfo;
26
import android.content.res.Resources;
27 23
import android.opengl.GLES30;
28 24
import android.opengl.GLES31;
29
import android.util.Log;
25

  
26
import java.io.InputStream;
27
import java.nio.ByteBuffer;
28
import java.nio.ByteOrder;
29
import java.nio.FloatBuffer;
30
import java.nio.IntBuffer;
31
import java.util.regex.Matcher;
32
import java.util.regex.Pattern;
30 33

  
31 34
import org.distorted.library.R;
32 35
import org.distorted.library.effect.Effect;
......
44 47
import org.distorted.library.program.VertexCompilationException;
45 48
import org.distorted.library.type.Dynamic;
46 49

  
47
import java.io.InputStream;
48
import java.nio.ByteBuffer;
49
import java.nio.ByteOrder;
50
import java.nio.FloatBuffer;
51
import java.nio.IntBuffer;
52
import java.util.regex.Matcher;
53
import java.util.regex.Pattern;
54

  
55 50
///////////////////////////////////////////////////////////////////////////////////////////////////
56 51
/**
57 52
 * A singleton class used to control various global dialog_settings.
......
219 214
   * compile its OIT problem only on the first attempt to use the OIT
220 215
   * Those will mainly be hardware-related: shaders do not compile on particular hardware, the required
221 216
   * OpenGL ES 3.0 is not supported, etc.
217
   *
218
   * Additionally, the User must be able to provide version of the OpenGL supported by the underlying
219
   * hardware and InputStreams to given local files.
222 220
   */
223
  public interface ExceptionListener
221
  public interface LibraryUser
224 222
    {
225 223
    void distortedException(Exception ex);
224
    int openGlVersion();
225
    InputStream localFile(int fileID);
226
    void logMessage(String message);
226 227
    }
227 228

  
228
  private static ExceptionListener mListener;
229
  private static Resources mResources;
229
  private static LibraryUser mUser;
230 230

  
231 231
///////////////////////////////////////////////////////////////////////////////////////////////////
232 232
// private: hide this from Javadoc
......
241 241
  private static void createMainProgram()
242 242
    {
243 243
    // MAIN PROGRAM ////////////////////////////////////
244
    final InputStream mainVertStream = mResources.openRawResource(R.raw.main_vertex_shader);
245
    final InputStream mainFragStream = mResources.openRawResource(R.raw.main_fragment_shader);
244
    final InputStream mainVertStream = mUser.localFile(R.raw.main_vertex_shader);
245
    final InputStream mainFragStream = mUser.localFile(R.raw.main_fragment_shader);
246 246

  
247 247
    int numF = FragmentEffect.getNumEnabled();
248 248
    int numV = VertexEffect.getNumEnabled();
......
267 267
      }
268 268
    catch(Exception e)
269 269
      {
270
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile MAIN program: "+e.getMessage());
270
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile MAIN program: "+e.getMessage());
271 271
      throw new RuntimeException(e.getMessage());
272 272
      }
273 273

  
......
278 278
    mTransformFeedbackH= GLES30.glGetUniformLocation( mMainProgramH, "u_TransformFeedback");
279 279

  
280 280
    // BLIT PROGRAM ////////////////////////////////////
281
    final InputStream blitVertStream = mResources.openRawResource(R.raw.blit_vertex_shader);
282
    final InputStream blitFragStream = mResources.openRawResource(R.raw.blit_fragment_shader);
281
    final InputStream blitVertStream = mUser.localFile(R.raw.blit_vertex_shader);
282
    final InputStream blitFragStream = mUser.localFile(R.raw.blit_fragment_shader);
283 283

  
284 284
    try
285 285
      {
......
287 287
      }
288 288
    catch(Exception e)
289 289
      {
290
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile BLIT program: "+e.getMessage());
290
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile BLIT program: "+e.getMessage());
291 291
      throw new RuntimeException(e.getMessage());
292 292
      }
293 293

  
......
296 296
    mBlitDepthH    = GLES30.glGetUniformLocation( blitProgramH, "u_Depth");
297 297

  
298 298
    // BLIT DEPTH PROGRAM ////////////////////////////////////
299
    final InputStream blitDepthVertStream = mResources.openRawResource(R.raw.blit_depth_vertex_shader);
300
    final InputStream blitDepthFragStream = mResources.openRawResource(R.raw.blit_depth_fragment_shader);
299
    final InputStream blitDepthVertStream = mUser.localFile(R.raw.blit_depth_vertex_shader);
300
    final InputStream blitDepthFragStream = mUser.localFile(R.raw.blit_depth_fragment_shader);
301 301

  
302 302
    try
303 303
      {
......
305 305
      }
306 306
    catch(Exception e)
307 307
      {
308
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile BLIT DEPTH program: "+e.getMessage());
308
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile BLIT DEPTH program: "+e.getMessage());
309 309
      throw new RuntimeException(e.getMessage());
310 310
      }
311 311

  
......
317 317

  
318 318
///////////////////////////////////////////////////////////////////////////////////////////////////
319 319

  
320
  private static void createNormalProgram(Resources resources)
320
  private static void createNormalProgram()
321 321
    {
322 322
    // NORMAL PROGRAM //////////////////////////////////////
323
    final InputStream normalVertexStream   = resources.openRawResource(R.raw.normal_vertex_shader);
324
    final InputStream normalFragmentStream = resources.openRawResource(R.raw.normal_fragment_shader);
323
    final InputStream normalVertexStream   = mUser.localFile(R.raw.normal_vertex_shader);
324
    final InputStream normalFragmentStream = mUser.localFile(R.raw.normal_fragment_shader);
325 325

  
326 326
    try
327 327
      {
......
329 329
      }
330 330
    catch(Exception e)
331 331
      {
332
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile NORMAL program: "+e.getMessage());
332
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile NORMAL program: "+e.getMessage());
333 333
      throw new RuntimeException(e.getMessage());
334 334
      }
335 335

  
......
339 339

  
340 340
///////////////////////////////////////////////////////////////////////////////////////////////////
341 341

  
342
  private static void createFullProgram(Resources resources)
342
  private static void createFullProgram()
343 343
    {
344
    final InputStream fullVertStream = resources.openRawResource(R.raw.main_vertex_shader);
345
    final InputStream fullFragStream = resources.openRawResource(R.raw.main_fragment_shader);
344
    final InputStream fullVertStream = mUser.localFile(R.raw.main_vertex_shader);
345
    final InputStream fullFragStream = mUser.localFile(R.raw.main_fragment_shader);
346 346

  
347 347
    int numV = VertexEffect.getAllEnabled();
348 348

  
......
367 367
      }
368 368
    catch(Exception e)
369 369
      {
370
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile FULL program: "+e.getMessage());
370
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile FULL program: "+e.getMessage());
371 371
      throw new RuntimeException(e.getMessage());
372 372
      }
373 373

  
......
378 378

  
379 379
///////////////////////////////////////////////////////////////////////////////////////////////////
380 380

  
381
  private static void createOITProgram(Resources resources)
381
  private static void createOITProgram()
382 382
    {
383 383
    // MAIN OIT PROGRAM ////////////////////////////////
384
    final InputStream mainVertStream = resources.openRawResource(R.raw.main_vertex_shader);
385
    final InputStream mainFragStream = resources.openRawResource(R.raw.main_fragment_shader);
384
    final InputStream mainVertStream = mUser.localFile(R.raw.main_vertex_shader);
385
    final InputStream mainFragStream = mUser.localFile(R.raw.main_fragment_shader);
386 386

  
387 387
    int numF = FragmentEffect.getNumEnabled();
388 388
    int numV = VertexEffect.getNumEnabled();
......
404 404
      }
405 405
    catch(Exception e)
406 406
      {
407
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile MAIN OIT program: "+e.getMessage());
407
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile MAIN OIT program: "+e.getMessage());
408 408
      throw new RuntimeException(e.getMessage());
409 409
      }
410 410

  
......
416 416
    mMainOITNumRecordsH = GLES30.glGetUniformLocation( mMainOITProgramH, "u_numRecords");
417 417

  
418 418
    // OIT CLEAR PROGRAM ////////////////////////////////////
419
    final InputStream oitClearVertStream = resources.openRawResource(R.raw.oit_vertex_shader);
420
    final InputStream oitClearFragStream = resources.openRawResource(R.raw.oit_clear_fragment_shader);
419
    final InputStream oitClearVertStream = mUser.localFile(R.raw.oit_vertex_shader);
420
    final InputStream oitClearFragStream = mUser.localFile(R.raw.oit_clear_fragment_shader);
421 421

  
422 422
    try
423 423
      {
......
425 425
      }
426 426
    catch(Exception e)
427 427
      {
428
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile OIT CLEAR program: "+e.getMessage());
428
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile OIT CLEAR program: "+e.getMessage());
429 429
      throw new RuntimeException(e.getMessage());
430 430
      }
431 431

  
......
435 435
    mOITClearSizeH         = GLES30.glGetUniformLocation( oitClearProgramH, "u_Size");
436 436

  
437 437
    // OIT BUILD PROGRAM ////////////////////////////////////
438
    final InputStream oitBuildVertStream = resources.openRawResource(R.raw.oit_vertex_shader);
439
    final InputStream oitBuildFragStream = resources.openRawResource(R.raw.oit_build_fragment_shader);
438
    final InputStream oitBuildVertStream = mUser.localFile(R.raw.oit_vertex_shader);
439
    final InputStream oitBuildFragStream = mUser.localFile(R.raw.oit_build_fragment_shader);
440 440

  
441 441
    try
442 442
      {
......
444 444
      }
445 445
    catch(Exception e)
446 446
      {
447
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile OIT BUILD program: "+e.getMessage());
447
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile OIT BUILD program: "+e.getMessage());
448 448
      throw new RuntimeException(e.getMessage());
449 449
      }
450 450

  
......
457 457
    mOITBuildNumRecordsH   = GLES30.glGetUniformLocation( oitBuildProgramH, "u_numRecords");
458 458

  
459 459
    // OIT COLLAPSE PROGRAM ///////////////////////////
460
    final InputStream oitCollapseVertStream = resources.openRawResource(R.raw.oit_vertex_shader);
461
    final InputStream oitCollapseFragStream = resources.openRawResource(R.raw.oit_collapse_fragment_shader);
460
    final InputStream oitCollapseVertStream = mUser.localFile(R.raw.oit_vertex_shader);
461
    final InputStream oitCollapseFragStream = mUser.localFile(R.raw.oit_collapse_fragment_shader);
462 462

  
463 463
    try
464 464
      {
......
466 466
      }
467 467
    catch(Exception e)
468 468
      {
469
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile OIT COLLAPSE program: "+e.getMessage());
469
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile OIT COLLAPSE program: "+e.getMessage());
470 470
      throw new RuntimeException(e.getMessage());
471 471
      }
472 472

  
......
477 477
    mOITCollapseSizeH         = GLES30.glGetUniformLocation( oitCollapseProgramH, "u_Size");
478 478

  
479 479
    // OIT RENDER PROGRAM ///////////////////////////
480
    final InputStream oitRenderVertStream = resources.openRawResource(R.raw.oit_vertex_shader);
481
    final InputStream oitRenderFragStream = resources.openRawResource(R.raw.oit_render_fragment_shader);
480
    final InputStream oitRenderVertStream = mUser.localFile(R.raw.oit_vertex_shader);
481
    final InputStream oitRenderFragStream = mUser.localFile(R.raw.oit_render_fragment_shader);
482 482

  
483 483
    try
484 484
      {
......
486 486
      }
487 487
    catch(Exception e)
488 488
      {
489
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile OIT RENDER program: "+e.getMessage());
489
      mUser.logMessage(e.getClass().getSimpleName()+" trying to compile OIT RENDER program: "+e.getMessage());
490 490
      throw new RuntimeException(e.getMessage());
491 491
      }
492 492

  
......
504 504
      {
505 505
      try
506 506
        {
507
        createNormalProgram(mResources);
507
        createNormalProgram();
508 508
        }
509 509
      catch(Exception ex)
510 510
        {
511
        mListener.distortedException(ex);
511
        mUser.distortedException(ex);
512 512
        return;
513 513
        }
514 514
      }
......
546 546
      {
547 547
      try
548 548
        {
549
        createFullProgram(mResources);
549
        createFullProgram();
550 550
        }
551 551
      catch(Exception ex)
552 552
        {
553
        mListener.distortedException(ex);
553
        mUser.distortedException(ex);
554 554
        return;
555 555
        }
556 556
      }
......
684 684
      }
685 685
    else
686 686
      {
687
      Log.e("effects", "print: failed to map atomic buffer");
687
      mUser.logMessage("printPreviousBuffer: failed to map atomic buffer");
688 688
      }
689 689

  
690 690
    GLES30.glUnmapBuffer(GLES31.GL_ATOMIC_COUNTER_BUFFER);
......
705 705
      }
706 706
    else
707 707
      {
708
      Log.e("effects", "zero: failed to map atomic buffer");
708
      mUser.logMessage("zeroBuffer: failed to map atomic buffer");
709 709
      }
710 710

  
711 711
    GLES30.glUnmapBuffer(GLES31.GL_ATOMIC_COUNTER_BUFFER);
......
761 761

  
762 762
        try
763 763
          {
764
          createOITProgram(mResources);
764
          createOITProgram();
765 765
          }
766 766
        catch(Exception ex)
767 767
          {
768
          mListener.distortedException(ex);
768
          mUser.distortedException(ex);
769 769
          return;
770 770
          }
771 771
        }
......
933 933

  
934 934
            if( drvVersion<22 )
935 935
              {
936
              Log.e("DISTORTED", "You are running this on a ARM Mali driver r"+driverVersion+".\n" +
936
              mUser.logMessage("You are running this on a ARM Mali driver r"+driverVersion+".\n" +
937 937
                    "This is a buggy driver, please update to r22. Inserting workaround which uses a lot of memory.");
938 938

  
939 939
              mFBOQueueSize = queueSize;
......
943 943
        }
944 944
      catch(Exception ex)
945 945
        {
946
        android.util.Log.e("library", "exception trying to pattern match version: "+ex.toString());
946
        mUser.logMessage("DistortedLibrary: exception trying to pattern match version: "+ex.toString());
947 947
        }
948 948
      }
949 949
    else if( mVendor.contains("Imagination") )
950 950
      {
951 951
      if( mRenderer.contains("GE8") )
952 952
        {
953
        Log.e("DISTORTED", "You are running this on a PowerVR GE8XXX.\nDue to a buggy compiler OIT rendering will not work");
954
        Log.e("DISTORTED", "GLSL Version "+GLES30.glGetString(GLES31.GL_SHADING_LANGUAGE_VERSION));
953
        mUser.logMessage("You are running this on a PowerVR GE8XXX.\nDue to a buggy compiler OIT rendering will not work");
954
        mUser.logMessage("GLSL Version "+GLES30.glGetString(GLES31.GL_SHADING_LANGUAGE_VERSION));
955 955
        }
956 956
      }
957 957
    else if( mVendor.contains("Qualcomm"))
......
960 960

  
961 961
      if( mRenderer.contains("308") && (driverVersion==331 || driverVersion==415) )
962 962
        {
963
        Log.e("DISTORTED", "You are running this on an Adreno 308 driver 331 or 415.\nStrange shit might happen.");
963
        mUser.logMessage("You are running this on an Adreno 308 driver 331 or 415.\nStrange shit might happen.");
964 964
        mBuggyUBOs = true;
965 965
        }
966 966
      if( mGLSL<=300 && driverVersion<415 ) // This is only on old enough drivers, 84,95,100,104,140 and known bad, 415 is known good.
967 967
        {
968
        Log.e("DISTORTED", "Slow compilation of Transform Feedback programs!");
968
        mUser.logMessage("Slow compilation of Transform Feedback programs!");
969 969
        mFastCompilationTF = false;
970 970
        }
971 971
      }
972 972
    }
973 973

  
974
///////////////////////////////////////////////////////////////////////////////////////////////////
975
/**
976
 * Not an external API
977
 *
978
 * @y.exclude
979
 */
980

  
981
  public static void logMessage(String message)
982
    {
983
    mUser.logMessage(message);
984
    }
985

  
974 986
///////////////////////////////////////////////////////////////////////////////////////////////////
975 987
/**
976 988
 * Return OpenGL ES version supported by the hardware we are running on.
......
989 1001
 * <p>
990 1002
 * Needs to be called from a thread holding the OpenGL context.
991 1003
 *
992
 * @param context  Context of the App using the library - used to open up Resources and read Shader code.
993
 * @param listener The library will send all (asynchronous!) exceptions there.
1004
 * @param user The Code which will be using this library, which must implement the LibraryUser interface.
994 1005
 */
995
  public static void onSurfaceCreated(final Context context, final ExceptionListener listener)
1006
  public static void onSurfaceCreated(final LibraryUser user)
996 1007
    {
997
    onSurfaceCreated(context,listener,4);
1008
    onSurfaceCreated(user,4);
998 1009
    }
999 1010

  
1000 1011
///////////////////////////////////////////////////////////////////////////////////////////////////
......
1004 1015
 * <p>
1005 1016
 * Needs to be called from a thread holding the OpenGL context.
1006 1017
 *   
1007
 * @param context   Context of the App using the library - used to open up Resources and read Shader code.
1008
 * @param listener  The library will send all (asynchronous!) exceptions there.
1018
 * @param user The Code which will be using this library, which must implement the LibraryUser interface.
1009 1019
 * @param queueSize the size of the FBO queue, a workaround for the bug on Mali drivers. Use a small integer - 1,...,4
1010 1020
 */
1011
  public static void onSurfaceCreated(final Context context, final ExceptionListener listener, int queueSize)
1021
  public static void onSurfaceCreated(final LibraryUser user, int queueSize)
1012 1022
    {
1013
    final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
1014
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
1015

  
1016
    int glESversion = configurationInfo.reqGlEsVersion;
1017
    int major = glESversion >> 16;
1018
    int minor = glESversion & 0xff;
1019

  
1020
    mListener = listener;
1023
    mUser = user;
1024
    int version = mUser.openGlVersion();
1025
    int major = version/100;
1026
    int minor = ((version/10)%10);
1021 1027

  
1022 1028
    if( major< 3 )
1023 1029
      {
1024 1030
      mGLSL = 100*major + 10*minor;
1025 1031
      VertexCompilationException ex = new VertexCompilationException("at least OpenGL ES 3.0 required, this device supports only "+major+"."+minor);
1026
      mListener.distortedException(ex);
1032
      mUser.distortedException(ex);
1027 1033
      }
1028 1034
    else
1029 1035
      {
......
1038 1044
    GLES30.glGetIntegerv(GLES30.GL_MAX_FRAGMENT_UNIFORM_VECTORS, tmp, 0);
1039 1045
    mMaxNumberOfFraUniforms = tmp[0];
1040 1046

  
1041
    android.util.Log.e("DISTORTED", "Using OpenGL ES "+major+"."+minor);
1047
    mUser.logMessage("Using OpenGL ES "+major+"."+minor);
1042 1048
/*
1043
    android.util.Log.e("DISTORTED", "max texture size: "+mMaxTextureSize);
1044
    android.util.Log.e("DISTORTED", "max num vert: "+mMaxNumberOfVerUniforms);
1045
    android.util.Log.e("DISTORTED", "max num frag: "+mMaxNumberOfFraUniforms);
1049
    mUser.logMessage("max texture size: "+mMaxTextureSize);
1050
    mUser.logMessage("max num vert: "+mMaxNumberOfVerUniforms);
1051
    mUser.logMessage("max num frag: "+mMaxNumberOfFraUniforms);
1046 1052
*/
1047 1053
    mGLSL_VERSION = "#version "+mGLSL+" es\n";
1048 1054

  
......
1052 1058
    detectBuggyDriversAndSetQueueSize(queueSize);
1053 1059
    EffectMessageSender.startSending();
1054 1060

  
1055
    mResources = context.getResources();
1056

  
1057 1061
    try
1058 1062
      {
1059 1063
      createMainProgram();
1060 1064
      }
1061 1065
    catch(Exception ex)
1062 1066
      {
1063
      mListener.distortedException(ex);
1067
      mUser.distortedException(ex);
1064 1068
      }
1065 1069

  
1066 1070
    try
1067 1071
      {
1068
      EffectQueuePostprocess.createPrograms(mResources, mGLSL);
1072
      final InputStream vertStream = mUser.localFile(R.raw.main_vertex_shader);
1073
      final InputStream fragStream = mUser.localFile(R.raw.preprocess_fragment_shader);
1074
      EffectQueuePostprocess.createPrograms(vertStream, fragStream, mGLSL);
1069 1075
      }
1070 1076
    catch(Exception ex)
1071 1077
      {
1072
      mListener.distortedException(ex);
1078
      mUser.distortedException(ex);
1073 1079
      }
1074 1080

  
1075 1081
    try
......
1078 1084
      }
1079 1085
    catch(Exception ex)
1080 1086
      {
1081
      mListener.distortedException(ex);
1087
      mUser.distortedException(ex);
1082 1088
      }
1083 1089
    }
1084 1090

  
src/main/java/org/distorted/library/main/DistortedNode.java
786 786
  public void debug(int depth)
787 787
    {
788 788
    String dbg = mEffects.debug(depth);
789
    android.util.Log.e("D", dbg);
789
    DistortedLibrary.logMessage(dbg);
790 790

  
791 791
    int numChildren = mChildren.getNumChildren();
792 792

  
src/main/java/org/distorted/library/main/DistortedScreen.java
209 209

  
210 210
    if( err!=GLES30.GL_NO_ERROR )
211 211
      {
212
      android.util.Log.e("D", "DISTORTED: OpenGL error "+err);
212
      DistortedLibrary.logMessage("DistortedScreen: OpenGL error "+err);
213 213
      }
214 214
*/
215 215
    return numrender+1;
src/main/java/org/distorted/library/main/DistortedTexture.java
147 147

  
148 148
    if( width>max || height>max )
149 149
      {
150
      android.util.Log.e("texture","error, trying to upload too large texture of size "+width+" x "+height+". Max is "+max);
150
      DistortedLibrary.logMessage("DistortedTexture: error, trying to upload too large texture of size "+width+" x "+height+". Max is "+max);
151 151
      return false;
152 152
      }
153 153
    else
......
178 178

  
179 179
    if( width>max || height>max )
180 180
      {
181
      android.util.Log.e("texture","error, trying to upload too large texture of size "+width+" x "+height+". Max is "+max);
181
      DistortedLibrary.logMessage("DistortedTexture: error, trying to upload too large texture of size "+width+" x "+height+". Max is "+max);
182 182
      return false;
183 183
      }
184 184
    else
src/main/java/org/distorted/library/main/InternalObject.java
73 73
      default       : str+=" ERROR? ";
74 74
      }
75 75

  
76
    android.util.Log.e("Object", str+printDetails()+msg);
76
    DistortedLibrary.logMessage("InternalObject: "+str+printDetails()+msg);
77 77
    }
78 78

  
79 79
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/main/InternalRenderState.java
273 273
    if( cState.stencilTest!=0 )
274 274
      {
275 275
      cState.stencilTest = 0;
276
      //android.util.Log.d("State", "stencil test off");
276
      //DistortedLibrary.logMessage("InternalRenderState: stencil test off");
277 277
      GLES30.glDisable(GLES30.GL_STENCIL_TEST);
278 278
      }
279 279

  
......
282 282
    if( cState.depthTest!=0 )
283 283
      {
284 284
      cState.depthTest = 0;
285
      //android.util.Log.d("State", "depth test off");
285
      //DistortedLibrary.logMessage("InternalRenderState: depth test off");
286 286
      GLES30.glDisable(GLES30.GL_DEPTH_TEST);
287 287
      }
288 288

  
......
297 297
      cState.colorMaskG = 0;
298 298
      cState.colorMaskB = 0;
299 299
      cState.colorMaskA = 0;
300
      //android.util.Log.d("State", "switch off color writing");
300
      //DistortedLibrary.logMessage("InternalRenderState: switch off color writing");
301 301
      GLES30.glColorMask(false,false,false,false);
302 302
      }
303 303

  
......
306 306
    if( cState.depthMask!=0 )
307 307
      {
308 308
      cState.depthMask = 0;
309
      //android.util.Log.d("State", "switch off depth writing");
309
      //DistortedLibrary.logMessage("InternalRenderState: switch off depth writing");
310 310
      GLES30.glDepthMask(false);
311 311
      }
312 312

  
......
315 315
    if( cState.stencilMask!= 0x00 )
316 316
      {
317 317
      cState.stencilMask = 0x00;
318
      //android.util.Log.d("State", "stencil mask off");
318
      //DistortedLibrary.logMessage("InternalRenderState: stencil mask off");
319 319
      GLES30.glStencilMask(cState.stencilMask);
320 320
      }
321 321
    }
......
329 329
    if( cState.stencilTest!=0 )
330 330
      {
331 331
      cState.stencilTest = 0;
332
      //android.util.Log.d("State", "stencil test off");
332
      //DistortedLibrary.logMessage("InternalRenderState: stencil test off");
333 333
      GLES30.glDisable(GLES30.GL_STENCIL_TEST);
334 334
      }
335 335

  
......
338 338
    if( cState.depthTest!=0 )
339 339
      {
340 340
      cState.depthTest = 0;
341
      //android.util.Log.d("State", "depth test off");
341
      //DistortedLibrary.logMessage("InternalRenderState: depth test off");
342 342
      GLES30.glDisable(GLES30.GL_DEPTH_TEST);
343 343
      }
344 344

  
......
353 353
      cState.colorMaskG = 1;
354 354
      cState.colorMaskB = 1;
355 355
      cState.colorMaskA = 1;
356
      //android.util.Log.d("State", "switch on color writing");
356
      //DistortedLibrary.logMessage("InternalRenderState: switch on color writing");
357 357
      GLES30.glColorMask(true,true,true,true);
358 358
      }
359 359

  
......
362 362
    if( cState.depthMask!=1 )
363 363
      {
364 364
      cState.depthMask = 1;
365
      //android.util.Log.d("State", "switch on depth writing");
365
      //DistortedLibrary.logMessage("InternalRenderState: switch on depth writing");
366 366
      GLES30.glDepthMask(true);
367 367
      }
368 368

  
......
371 371
    if( cState.stencilMask!= 0x00 )
372 372
      {
373 373
      cState.stencilMask = 0x00;
374
      //android.util.Log.d("State", "stencil mask off");
374
      //DistortedLibrary.logMessage("InternalRenderState: stencil mask off");
375 375
      GLES30.glStencilMask(cState.stencilMask);
376 376
      }
377 377
    }
......
435 435
    if( cState.stencilTest!=1 )
436 436
      {
437 437
      cState.stencilTest = 1;
438
      //android.util.Log.d("State", "stencil test on");
438
      //DistortedLibrary.logMessage("InternalRenderState: stencil test on");
439 439
      GLES30.glEnable(GLES30.GL_STENCIL_TEST);
440 440
      }
441 441

  
......
448 448
      cState.stencilFuncFunc = GLES30.GL_ALWAYS;
449 449
      cState.stencilFuncRef  = 1;
450 450
      cState.stencilFuncMask = STENCIL_MASK;
451
      //android.util.Log.d("State", "stencil func on");
451
      //DistortedLibrary.logMessage("InternalRenderState: stencil func on");
452 452
      GLES30.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
453 453
      }
454 454

  
......
461 461
      cState.stencilOpSfail = GLES30.GL_KEEP;
462 462
      cState.stencilOpDpfail= GLES30.GL_KEEP;
463 463
      cState.stencilOpDppass= GLES30.GL_REPLACE;
464
      //android.util.Log.d("State", "stencil op on");
464
      //DistortedLibrary.logMessage("InternalRenderState: stencil op on");
465 465
      GLES30.glStencilOp(cState.stencilOpSfail,cState.stencilOpDpfail,cState.stencilOpDppass);
466 466
      }
467 467

  
......
478 478
      cState.colorMaskG = clr;
479 479
      cState.colorMaskB = clr;
480 480
      cState.colorMaskA = clr;
481
      //android.util.Log.d("State", "switch off color writing");
481
      //DistortedLibrary.logMessage("InternalRenderState: switch off color writing");
482 482
      GLES30.glColorMask(color,color,color,color);
483 483
      }
484 484

  
......
487 487
    if( cState.depthMask!=1 )
488 488
      {
489 489
      cState.depthMask = 1;
490
      //android.util.Log.d("State", "switch on depth writing");
490
      //DistortedLibrary.logMessage("InternalRenderState: switch on depth writing");
491 491
      GLES30.glDepthMask(true);
492 492
      }
493 493

  
......
496 496
    if( cState.stencilMask!= STENCIL_MASK )
497 497
      {
498 498
      cState.stencilMask = STENCIL_MASK;
499
      //android.util.Log.d("State", "stencil mask on");
499
      //DistortedLibrary.logMessage("InternalRenderState: stencil mask on");
500 500
      GLES30.glStencilMask(cState.stencilMask);
501 501
      }
502 502
    }
......
648 648

  
649 649
  void apply()
650 650
    {
651
    //android.util.Log.e("State", "APPLYING STATE");
651
    //DistortedLibrary.logMessage("InternalRenderState: APPLYING STATE");
652 652

  
653 653
    /////////////////////////////////////////////////////
654 654
    // 1. Write to color buffer?
655 655
    if( mState.colorMaskR!=cState.colorMaskR || mState.colorMaskG!=cState.colorMaskG || mState.colorMaskB!=cState.colorMaskB || mState.colorMaskA!=cState.colorMaskA)
656 656
      {
657
      //android.util.Log.d("State", "setting color mask");
657
      //DistortedLibrary.logMessage("InternalRenderState: setting color mask");
658 658
      cState.colorMaskR = mState.colorMaskR;
659 659
      cState.colorMaskG = mState.colorMaskG;
660 660
      cState.colorMaskB = mState.colorMaskB;
......
670 670

  
671 671
      if (cState.depthTest == 0)
672 672
        {
673
        //android.util.Log.d("State", "disabling depth test");
673
        //DistortedLibrary.logMessage("InternalRenderState: disabling depth test");
674 674
        GLES30.glDisable(GLES30.GL_DEPTH_TEST);
675 675
        }
676 676
      else
677 677
        {
678
        //android.util.Log.d("State", "enable depth test");
678
        //DistortedLibrary.logMessage("InternalRenderState: enable depth test");
679 679
        GLES30.glEnable(GLES30.GL_DEPTH_TEST);
680 680
        }
681 681
      }
......
684 684
    // 3. Change Depth Function?
685 685
    if( mState.depthFunc!=cState.depthFunc )
686 686
      {
687
      //android.util.Log.d("State", "setting depth func");
687
      //DistortedLibrary.logMessage("InternalRenderState: setting depth func");
688 688
      cState.depthFunc = mState.depthFunc;
689 689
      GLES30.glDepthFunc(cState.depthFunc);
690 690
      }
......
693 693
    // 4. Write to Depth buffer?
694 694
    if( mState.depthMask!=cState.depthMask )
695 695
      {
696
      //android.util.Log.d("State", "setting depth mask");
696
      //DistortedLibrary.logMessage("InternalRenderState: setting depth mask");
697 697
      cState.depthMask = mState.depthMask;
698 698
      GLES30.glDepthMask(cState.depthMask==1);
699 699
      }
......
706 706

  
707 707
      if (cState.blend == 0)
708 708
        {
709
        //android.util.Log.d("State", "disabling blending");
709
        //DistortedLibrary.logMessage("InternalRenderState: disabling blending");
710 710
        GLES30.glDisable(GLES30.GL_BLEND);
711 711
        }
712 712
      else
713 713
        {
714
        //android.util.Log.d("State", "enabling blending");
714
        //DistortedLibrary.logMessage("InternalRenderState: enabling blending");
715 715
        GLES30.glEnable(GLES30.GL_BLEND);
716 716
        }
717 717
      }
......
720 720
    // 6. Change Blend function?
721 721
    if( mState.blendSrc!=cState.blendSrc || mState.blendDst!=cState.blendDst )
722 722
      {
723
      //android.util.Log.d("State", "setting blend function");
723
      //DistortedLibrary.logMessage("InternalRenderState: setting blend function");
724 724
      cState.blendSrc = mState.blendSrc;
725 725
      cState.blendDst = mState.blendDst;
726 726
      GLES30.glBlendFunc(cState.blendSrc,cState.blendDst);
......
734 734

  
735 735
      if (cState.stencilTest == 0)
736 736
        {
737
        //android.util.Log.d("State", "disabling stencil test");
737
        //DistortedLibrary.logMessage("InternalRenderState: disabling stencil test");
738 738
        GLES30.glDisable(GLES30.GL_STENCIL_TEST);
739 739
        }
740 740
      else
741 741
        {
742
        //android.util.Log.d("State", "enabling stencil test");
742
        //DistortedLibrary.logMessage("InternalRenderState: enabling stencil test");
743 743
        GLES30.glEnable(GLES30.GL_STENCIL_TEST);
744 744
        }
745 745
      }
......
748 748
    // 8. Adjust Stencil function?
749 749
    if( mState.stencilFuncFunc!=cState.stencilFuncFunc || mState.stencilFuncRef!=cState.stencilFuncRef || mState.stencilFuncMask!=cState.stencilFuncMask )
750 750
      {
751
      //android.util.Log.d("State", "setting stencil function");
751
      //DistortedLibrary.logMessage("InternalRenderState: setting stencil function");
752 752
      cState.stencilFuncFunc = mState.stencilFuncFunc;
753 753
      cState.stencilFuncRef  = mState.stencilFuncRef ;
754 754
      cState.stencilFuncMask = mState.stencilFuncMask;
......
759 759
    // 9. Adjust Stencil operation?
760 760
    if( mState.stencilOpSfail!=cState.stencilOpSfail || mState.stencilOpDpfail!=cState.stencilOpDpfail || mState.stencilOpDppass!=cState.stencilOpDppass )
761 761
      {
762
      //android.util.Log.d("State", "setting stencil op");
762
      //DistortedLibrary.logMessage("InternalRenderState: setting stencil op");
763 763
      cState.stencilOpSfail = mState.stencilOpSfail;
764 764
      cState.stencilOpDpfail= mState.stencilOpDpfail;
765 765
      cState.stencilOpDppass= mState.stencilOpDppass;
......
770 770
    // 10. Write to Stencil buffer?
771 771
    if( mState.stencilMask!=cState.stencilMask )
772 772
      {
773
      //android.util.Log.d("State", "setting stencil mask");
773
      //DistortedLibrary.logMessage("InternalRenderState: setting stencil mask");
774 774
      cState.stencilMask = mState.stencilMask;
775 775
      GLES30.glStencilMask(cState.stencilMask);
776 776
      }
......
779 779
    // 11. Clear buffers?
780 780
    if( mClear!=0 )
781 781
      {
782
      //android.util.Log.d("State", "clearing buffer");
782
      //DistortedLibrary.logMessage("InternalRenderState: clearing buffer");
783 783
      GLES30.glClear(mClear);
784 784
      }
785 785
    }
src/main/java/org/distorted/library/main/InternalStackFrame.java
371 371

  
372 372
  static void debugListsGeneric(LinkedList<InternalObject> list, HashMap<Long,Job> map,String frameMarker)
373 373
    {
374
    android.util.Log.e("Object", frameMarker);
375
    android.util.Log.e("Object", "  Done list:");
374
    DistortedLibrary.logMessage("InternalStackFrame: "+frameMarker);
375
    DistortedLibrary.logMessage("InternalStackFrame:  Done list:");
376 376

  
377 377
    for(InternalObject object : list)
378 378
      {
379 379
      object.print("  ");
380 380
      }
381 381

  
382
    android.util.Log.e("Object", "  ToDo list:");
382
    DistortedLibrary.logMessage("InternalStackFrame: ToDo list:");
383 383

  
384 384
    Job job;
385 385

  
......
394 394

  
395 395
  void debugMap(String frameMarker)
396 396
    {
397
    android.util.Log.e("Object", frameMarker);
397
    DistortedLibrary.logMessage("InternalStackFrame: "+frameMarker);
398 398
    InternalNodeData tmp;
399 399

  
400 400
    for(ArrayList<Long> key: mMapNodeID.keySet())
401 401
      {
402 402
      tmp = mMapNodeID.get(key);
403
      android.util.Log.e("NodeData", "NodeID: "+tmp.ID+" <-- "+key);
403
      DistortedLibrary.logMessage("InternalStackFrame: NodeID: "+tmp.ID+" <-- "+key);
404 404
      }
405 405
    }
406 406
  }
src/main/java/org/distorted/library/mesh/DeferredJobs.java
28 28

  
29 29
import java.util.ArrayList;
30 30

  
31
import android.util.Log;
32

  
33 31
///////////////////////////////////////////////////////////////////////////////////////////////////
34 32
/**
35 33
 * Not part of public API, do not document (public only because has to be cleaned from the main package)
......
201 199

  
202 200
      str += (" next: "+numNext+" prev: "+numPrev);
203 201

  
204
      Log.e("job", str);
202
      DistortedLibrary.logMessage("DeferredJobs: "+str);
205 203

  
206 204
      for(int i=0; i<numPrev; i++)
207 205
        {
src/main/java/org/distorted/library/mesh/MeshBase.java
22 22

  
23 23
import android.opengl.GLES30;
24 24
import android.opengl.Matrix;
25
import android.util.Log;
26 25

  
27 26
import org.distorted.library.effect.MatrixEffect;
28 27
import org.distorted.library.effect.VertexEffect;
29 28
import org.distorted.library.effectqueue.EffectQueue;
29
import org.distorted.library.main.DistortedLibrary;
30 30
import org.distorted.library.main.InternalBuffer;
31 31
import org.distorted.library.program.DistortedProgram;
32 32
import org.distorted.library.type.Static4D;
......
462 462

  
463 463
     if( origVertices!=mNumVertices )
464 464
       {
465
       android.util.Log.e("mesh", "join: origVertices: "+origVertices+" numVertices: "+mNumVertices);
465
       DistortedLibrary.logMessage("MeshBase: join: origVertices: "+origVertices+" numVertices: "+mNumVertices);
466 466
       }
467 467

  
468 468
     int endIndex, index=0, numEffComp = mEffComponent.size();
......
621 621
     else
622 622
       {
623 623
       int error = GLES30.glGetError();
624
       Log.e("mesh", "failed to map tf buffer, error="+error);
624
       DistortedLibrary.logMessage("MeshBase: failed to map tf buffer, error="+error);
625 625
       }
626 626

  
627 627
     GLES30.glUnmapBuffer(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER);
......
641 641
       }
642 642
     else
643 643
       {
644
       android.util.Log.e("mesh", "JobNode null");
644
       DistortedLibrary.logMessage("MeshBase: JobNode null");
645 645
       }
646 646
     }
647 647

  
......
670 670
         sb.append(") ");
671 671
         }
672 672

  
673
       Log.d("mesh", sb.toString() );
673
       DistortedLibrary.logMessage("MeshBase: "+sb.toString() );
674 674
       }
675 675
     }
676 676

  
......
694 694
       sb.append(mVertAttribs1[VERT1_ATTRIBS*i+POS_ATTRIB+2]);
695 695
       sb.append(") ");
696 696
       }
697
     Log.d("mesh", sb.toString());
697
     DistortedLibrary.logMessage("MeshBase: "+sb.toString());
698 698
     }
699 699

  
700 700
///////////////////////////////////////////////////////////////////////////////////////////////////
......
713 713
       sb.append(' ');
714 714
       }
715 715

  
716
     Log.d("mesh", sb.toString());
716
     DistortedLibrary.logMessage("MeshBase: "+sb.toString());
717 717
     }
718 718

  
719 719
///////////////////////////////////////////////////////////////////////////////////////////////////
......
745 745
         }
746 746
       }
747 747

  
748
     Log.d("mesh", sb.toString());
748
     DistortedLibrary.logMessage("MeshBase: "+sb.toString());
749 749
     }
750 750

  
751 751
///////////////////////////////////////////////////////////////////////////////////////////////////
......
907 907
         }
908 908
       else
909 909
         {
910
         android.util.Log.e("mesh", "Error: unknown mesh file version "+String.format("0x%08X", version));
910
         DistortedLibrary.logMessage("MeshBase: Error: unknown mesh file version "+String.format("0x%08X", version));
911 911
         return 0;
912 912
         }
913 913
       }
914 914
     catch(Exception e)
915 915
       {
916
       android.util.Log.e("mesh", "Exception1 trying to read file: "+e.toString());
916
       DistortedLibrary.logMessage("MeshBase: Exception1 trying to read file: "+e.toString());
917 917
       return 0;
918 918
       }
919 919

  
......
941 941
         }
942 942
       catch(Exception e)
943 943
         {
944
         android.util.Log.e("mesh", "Exception2 trying to read file: "+e.toString());
944
         DistortedLibrary.logMessage("MeshBase: Exception2 trying to read file: "+e.toString());
945 945
         return 0;
946 946
         }
947 947

  
......
1008 1008

  
1009 1009
                  floatBuf.get(mVertAttribs1, 0, VERT1_ATTRIBS*mNumVertices);
1010 1010
                  break;
1011
         default: android.util.Log.e("mesh", "Error: unknown mesh file version "+String.format("0x%08X", version));
1011
         default: DistortedLibrary.logMessage("MeshBase: Error: unknown mesh file version "+String.format("0x%08X", version));
1012 1012
                  return 0;
1013 1013
         }
1014 1014

  
......
1101 1101
       }
1102 1102
     catch(IOException ex)
1103 1103
       {
1104
       android.util.Log.e("mesh", "IOException trying to write a mesh: "+ex.toString());
1104
       DistortedLibrary.logMessage("MeshBase: IOException trying to write a mesh: "+ex.toString());
1105 1105
       }
1106 1106
     }
1107 1107

  
src/main/java/org/distorted/library/mesh/MeshCubes.java
20 20

  
21 21
package org.distorted.library.mesh;
22 22

  
23
import org.distorted.library.main.DistortedLibrary;
23 24
import org.distorted.library.type.Static4D;
24 25

  
25 26
import java.util.ArrayList;
......
771 772
     mInflateY = null;
772 773

  
773 774
     if( currVert!=numVertices )
774
       android.util.Log.e("MeshCubes", "currVert " +currVert+" numVertices="+numVertices );
775
       DistortedLibrary.logMessage("MeshCubes: currVert " +currVert+" numVertices="+numVertices );
775 776

  
776 777
     setAttribs(attribs1,attribs2);
777 778
     }
src/main/java/org/distorted/library/mesh/MeshPolygon.java
21 21
package org.distorted.library.mesh;
22 22

  
23 23
///////////////////////////////////////////////////////////////////////////////////////////////////
24

  
25
import org.distorted.library.main.DistortedLibrary;
26

  
24 27
/**
25 28
 * Create a polygon of any shape and varying elevations from the edges towards the center.
26 29
 * <p>
......
278 281
    buildGrid(attribs1,attribs2);
279 282

  
280 283
    if( remainingVert!=0 )
281
      android.util.Log.d("MeshPolygon", "remainingVert " +remainingVert );
284
      DistortedLibrary.logMessage("MeshPolygon: remainingVert " +remainingVert );
282 285

  
283 286
    if( centerX!=0.0f || centerY!=0.0f )
284 287
      {
src/main/java/org/distorted/library/mesh/MeshSphere.java
21 21
package org.distorted.library.mesh;
22 22

  
23 23
///////////////////////////////////////////////////////////////////////////////////////////////////
24

  
25
import org.distorted.library.main.DistortedLibrary;
26

  
24 27
/**
25 28
 * Create a Mesh which approximates a sphere.
26 29
 * <p>
......
258 261
      }
259 262

  
260 263
    if( currentVert!=numVertices )
261
      android.util.Log.d("MeshSphere", "currentVert= " +currentVert+" numVertices="+numVertices );
264
      DistortedLibrary.logMessage("MeshSphere: currentVert= " +currentVert+" numVertices="+numVertices );
262 265

  
263 266
    setAttribs(attribs1, attribs2);
264 267
    }
src/main/java/org/distorted/library/mesh/MeshSquare.java
21 21
package org.distorted.library.mesh;
22 22

  
23 23
///////////////////////////////////////////////////////////////////////////////////////////////////
24

  
25
import org.distorted.library.main.DistortedLibrary;
26

  
24 27
/**
25 28
 * Create a flat, rectangular grid.
26 29
 * <p>
......
195 198
    buildGrid(attribs1,attribs2);
196 199

  
197 200
    if( remainingVert!=0 )
198
      android.util.Log.d("MeshRectangles", "remainingVert " +remainingVert );
201
      DistortedLibrary.logMessage("MeshSquare: remainingVert " +remainingVert );
199 202

  
200 203
    setAttribs(attribs1,attribs2);
201 204
    }
......
220 223
    buildGrid(attribs1,attribs2,xLoc,yLoc);
221 224

  
222 225
    if( remainingVert!=0 )
223
      android.util.Log.d("MeshRectangles", "remainingVert " +remainingVert );
226
      DistortedLibrary.logMessage("MeshSquare: remainingVert " +remainingVert );
224 227

  
225 228
    setAttribs(attribs1,attribs2);
226 229
    }
src/main/java/org/distorted/library/mesh/MeshTriangle.java
21 21
package org.distorted.library.mesh;
22 22

  
23 23
///////////////////////////////////////////////////////////////////////////////////////////////////
24

  
25
import org.distorted.library.main.DistortedLibrary;
26

  
24 27
/**
25 28
 * Create a Mesh which approximates a triangle with vertices at (-0.5,-0.5),(+0.5,-0.5),(0.0,0.5)
26 29
 */
......
114 117
     buildGrid(attribs1, attribs2, level);
115 118

  
116 119
     if( remainingVert!=0 )
117
       android.util.Log.d("MeshTriangles", "remainingVert " +remainingVert );
120
       DistortedLibrary.logMessage("MeshTriangle: remainingVert " +remainingVert );
118 121

  
119 122
     setAttribs(attribs1, attribs2);
120 123
     }
src/main/java/org/distorted/library/program/DistortedProgram.java
22 22

  
23 23
import android.opengl.GLES30;
24 24

  
25
import org.distorted.library.main.DistortedLibrary;
26

  
25 27
import java.io.BufferedReader;
26 28
import java.io.IOException;
27 29
import java.io.InputStream;
......
91 93
      final int[] numberOfUniforms = new int[1];
92 94
      GLES30.glGetProgramiv(programHandle, GLES30.GL_ACTIVE_UNIFORMS, numberOfUniforms, 0);
93 95

  
94
      //android.util.Log.d("program", "number of active uniforms="+numberOfUniforms[0]);
96
      //DistortedLibrary.logMessage("DistortedProgram: number of active uniforms="+numberOfUniforms[0]);
95 97
      }
96 98

  
97 99
    return programHandle;
......
137 139

  
138 140
      if( subline.startsWith(mUniformStr))
139 141
        {
140
        //android.util.Log.e("program", "GOOD LINE: " +subline+" subLen="+subLen);
142
        //DistortedLibrary.logMessage("DistortedProgram: GOOD LINE: " +subline+" subLen="+subLen);
141 143

  
142 144
        for(nameBegin=subLen-1; nameBegin>mUniformLen-2; nameBegin--)
143 145
          {
......
259 261

  
260 262
          if( attribute!=null )
261 263
            {
262
            //android.util.Log.d("program", "new attribute: "+attribute);
264
            //DistortedLibrary.logMessage("DistortedProgram: new attribute: "+attribute);
263 265
            if( attrList.length()>0 ) attrList+=" ";
264 266
            attrList += attribute;
265 267
            }
......
330 332
      }
331 333
    else
332 334
      {
333
      android.util.Log.e("Program", "Error: marker string not found in SHADER!");
335
      DistortedLibrary.logMessage("DistortedProgram: Error: marker string not found in SHADER!");
334 336
      }
335 337

  
336 338
    return null;
src/main/java/org/distorted/library/type/Dynamic.java
20 20

  
21 21
package org.distorted.library.type;
22 22

  
23
import org.distorted.library.main.DistortedLibrary;
24

  
23 25
import java.util.Random;
24 26
import java.util.Vector;
25 27

  
......
404 406
        t = ((int)(1000*baseV[i][j]))/(1000.0f);
405 407
        s+=(" "+t);
406 408
        }
407
      android.util.Log.e("dynamic", str+" base "+i+" : " + s);
409
      DistortedLibrary.logMessage("Dynamic: "+str+" base "+i+" : " + s);
408 410
      }
409 411
    }
410 412

  
......
429 431

  
430 432
      if( len[i] == 0.0f || len[0]/len[i] < 0.95f || len[0]/len[i]>1.05f )
431 433
        {
432
        android.util.Log.e("dynamic", "length of vector "+i+" : "+Math.sqrt(len[i]));
434
        DistortedLibrary.logMessage("Dynamic: length of vector "+i+" : "+Math.sqrt(len[i]));
433 435
        error = true;
434 436
        }
435 437
      }
......
448 450

  
449 451
        if( cosA > 0.05f || cosA < -0.05f )
450 452
          {
451
          android.util.Log.e("dynamic", "cos angle between vectors "+i+" and "+j+" : "+cosA);
453
          DistortedLibrary.logMessage("Dynamic: cos angle between vectors "+i+" and "+j+" : "+cosA);
452 454
          error = true;
453 455
          }
454 456
        }
src/main/java/org/distorted/library/uniformblock/UniformBlockAssociation.java
22 22

  
23 23
import android.opengl.GLES30;
24 24

  
25
import org.distorted.library.main.DistortedLibrary;
25 26
import org.distorted.library.main.InternalBuffer;
26 27
import org.distorted.library.mesh.MeshBase;
27 28

  
......
152 153

  
153 154
    String res = builder.toString();
154 155

  
155
    android.util.Log.e("uba", res);
156
    DistortedLibrary.logMessage("UniformBlockAssociation: "+res);
156 157
    }
157 158
  }
src/main/java/org/distorted/library/uniformblock/UniformBlockFloatUniforms.java
22 22

  
23 23
import android.opengl.GLES30;
24 24

  
25
import org.distorted.library.main.DistortedLibrary;
25 26
import org.distorted.library.main.InternalBuffer;
26 27

  
27 28
///////////////////////////////////////////////////////////////////////////////////////////////////
......
143 144

  
144 145
    String res = builder.toString();
145 146

  
146
    android.util.Log.e("ubp", res);
147
    DistortedLibrary.logMessage("UniformBlockFloatUniforms: "+res);
147 148
    }
148 149
  }
src/main/java/org/distorted/library/uniformblock/UniformBlockIntUniforms.java
23 23
import android.opengl.GLES30;
24 24

  
25 25
import org.distorted.library.effect.Effect;
26
import org.distorted.library.main.DistortedLibrary;
26 27
import org.distorted.library.main.InternalBuffer;
27 28

  
28 29
///////////////////////////////////////////////////////////////////////////////////////////////////
......
169 170

  
170 171
    String res = builder.toString();
171 172

  
172
    android.util.Log.e("ubp", res);
173
    DistortedLibrary.logMessage("UniformBlockIntUniforms: "+res);
173 174
    }
174 175
  }

Also available in: Unified diff