Project

General

Profile

« Previous | Next » 

Revision a4d59c0b

Added by Leszek Koltunski over 5 years ago

Massive: make the coordinate system agree with that of OpenGL (i.e. invert the Y axis).

View differences:

src/main/java/org/distorted/examples/inflate/InflateRenderer.java
110 110
    
111 111
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
112 112
      {
113
      final float SCALE = 0.75f;
114

  
113 115
      mScreenMin = width<height ? width:height;
114
      float factor = ( width*mObjHeight > height*mObjWidth ) ? (0.75f*height)/mObjHeight :  (0.75f*width)/mObjWidth;
115
      mMove.set( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0);
116
      float factor = ( width*mObjHeight > height*mObjWidth ) ? (SCALE*height)/mObjHeight :  (SCALE*width)/mObjWidth;
117
      mMove.set( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , -factor*mObjDepth/2 );
116 118
      mScale.set(factor,factor,factor);
117 119
      mCenter.set( (float)mObjWidth/2, (float)mObjHeight/2, (float)mObjDepth/2 );
118 120
      mScreen.resize(width, height);

Also available in: Unified diff