Project

General

Profile

« Previous | Next » 

Revision 278a214c

Added by Leszek Koltunski over 4 years ago

Convert Blur to stretchless API.

View differences:

src/main/java/org/distorted/examples/blur/BlurRenderer.java
56 56
    private DistortedFramebuffer mBuffer;
57 57
    private MeshRectangles mMesh, mMeshBuffer;
58 58
    private Static2D mHaloRadiusSta;
59
    private int mObjHeight, mObjWidth;
60 59
    private Static3D mScale, mBufferScale;
61 60

  
62 61
///////////////////////////////////////////////////////////////////////////////////////////////////
......
107 106
    
108 107
   public void onSurfaceChanged(GL10 glUnused, int width, int height)
109 108
     {
110
     float qw1 = (float)width /SIZE;
111
     float qh1 = (float)height/SIZE;
112
     float factor1 = 0.8f* (qw1<qh1 ? qw1:qh1);
109
     float factor1 = 0.8f* (Math.min(width, height));
113 110

  
114 111
     mBufferScale.set( factor1,factor1,factor1 );
115 112

  
116
     float qw2 = (float)SIZE/mObjWidth;
117
     float qh2 = (float)SIZE/mObjHeight;
118
     float factor2 = 0.9f* (qw2<qh2 ? qw2:qh2);
113
     float factor2 = 0.9f*SIZE;
119 114

  
120 115
     mScale.set( factor2,factor2,factor2 );
121 116

  
......
141 136
         }
142 137
       catch(IOException e) { }
143 138
       }
144
      
145
     mObjHeight = bitmap.getHeight();
146
     mObjWidth  = bitmap.getWidth();
147

  
148
     mMesh.setStretch(mObjWidth,mObjHeight,0);
149
     mMeshBuffer.setStretch(SIZE,SIZE,0);
150 139

  
151 140
     if( mTexture==null ) mTexture = new DistortedTexture();
152 141
     mTexture.setTexture(bitmap);

Also available in: Unified diff