Revision 19938eb7
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java | ||
---|---|---|
41 | 41 |
|
42 | 42 |
import android.graphics.Bitmap; |
43 | 43 |
import android.graphics.BitmapFactory; |
44 |
import android.opengl.GLES30; |
|
45 | 44 |
import android.opengl.GLSurfaceView; |
46 | 45 |
|
47 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
99 | 98 |
|
100 | 99 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
101 | 100 |
{ |
102 |
float scaleFactor = width>height ? height/3:width/3; |
|
101 |
float qx = (float)width ; |
|
102 |
float qy = (float)height; |
|
103 |
float scale = 0.5f; |
|
103 | 104 |
|
104 | 105 |
mEffects.abortEffects(EffectTypes.MATRIX); |
105 |
mEffects.move( new Static3D( (width-scaleFactor)/2 , (height-scaleFactor)/2 , 0) ); |
|
106 |
mEffects.scale(scaleFactor); |
|
107 |
mEffects.quaternion( mRot, new Static3D( (float)mTexture.getWidth()/2, (float)mTexture.getHeight()/2 , 0) ); |
|
108 |
|
|
106 |
mEffects.quaternion( mRot, new Static3D(0,0,0) ); |
|
107 |
mEffects.scale( qx<qy ? (new Static3D(scale,scale*qx/qy,scale)) : (new Static3D(scale*qy/qx,scale,scale)) ); |
|
108 |
|
|
109 | 109 |
mScreen.resize(width, height); |
110 | 110 |
} |
111 | 111 |
|
Also available in: Unified diff
Convert a few more APPs to the new resolution-independent Matrix Effects.