Project

General

Profile

« Previous | Next » 

Revision 5601cfa6

Added by Leszek Koltunski almost 4 years ago

Convert the last app, EffectQueue, to stretchless API.

View differences:

src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
45 45
///////////////////////////////////////////////////////////////////////////////////////////////////
46 46

  
47 47
class EffectQueueRenderer implements GLSurfaceView.Renderer, EffectListener
48
  {  
48
  {
49 49
  private static final int NUMLINES =  10;
50 50
  private static final int MESH_QUALITY = 100;
51 51
  static final int BWID = 600;
......
78 78
    MatrixEffectScale scaleEffect = new MatrixEffectScale(mScale);
79 79

  
80 80
    mMesh = new MeshRectangles(MESH_QUALITY,MESH_QUALITY*texHeight/texWidth);
81
    mMesh.setStretch(texWidth,texHeight,0);
82 81

  
83 82
    mTexture = new DistortedTexture();
84 83
    mEffects = new DistortedEffects();
......
135 134

  
136 135
  public void onSurfaceChanged(GL10 glUnused, int width, int height)
137 136
    {
138
    mScale.set((float)width/texWidth,(float)height/texHeight,1);
137
    // (w+h)/2 because we need to stretch more or less uniformly in all 3 directions.
138
    // If we set it to 0, Distort would not be shaded. If we set it to 1, the Distorted normal
139
    // vectors would get stretched only in X and Y dirs, becoming very 'flat' and the Distorted
140
    // area very dark.
141
    mScale.set(width, height, (width+height)*0.5f);
142

  
139 143
    mScreen.resize(width,height);
140 144
    mView.setScreenSize(width,height);
141 145
    }

Also available in: Unified diff