Project

General

Profile

« Previous | Next » 

Revision 1746198f

Added by Leszek Koltunski over 7 years ago

FBO APP: add dynamic adding/removing the DEPTH attachment.

View differences:

src/main/java/org/distorted/examples/fbo/FBORenderer.java
64 64
      mScreen = new DistortedFramebuffer(0);
65 65
      }
66 66

  
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

  
69
   void setDepth(boolean depth)
70
      {
71
      if( mRoot!=null )
72
        {
73
        DistortedFramebuffer tmp = mRoot.getFramebuffer();
74
        tmp.setDepthAttachment(depth);
75
        }
76
      }
77

  
67 78
///////////////////////////////////////////////////////////////////////////////////////////////////
68 79
   
69
    public void onDrawFrame(GL10 glUnused) 
80
   public void onDrawFrame(GL10 glUnused)
70 81
      {
71 82
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
72 83
      mScreen.renderTo(mRoot,System.currentTimeMillis());
......
74 85

  
75 86
///////////////////////////////////////////////////////////////////////////////////////////////////
76 87
    
77
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
88
   public void onSurfaceChanged(GL10 glUnused, int width, int height)
78 89
      { 
79 90
      mEffects.abortEffects(EffectTypes.MATRIX);
80 91
         
......
100 111

  
101 112
///////////////////////////////////////////////////////////////////////////////////////////////////
102 113
    
103
    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
114
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
104 115
      {
105 116
      GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
106 117

  
......
140 151
      mRoot = new DistortedTree(lisa, mEffects,new MeshFlat(1,1));
141 152
      mRoot.attach(grid,gridEffects,new MeshCubes(10,10,false));
142 153

  
143
      DistortedFramebuffer tmp = mRoot.getFramebuffer();
144
      tmp.setDepthAttachment(true);
145

  
146 154
      float factor = lisaWidth/(2.0f*gridWidth);
147 155

  
148 156
      gridEffects.move( new Static3D( (lisaWidth-factor*gridWidth)/2,(lisaHeight-factor*gridHeight)/2,0) );

Also available in: Unified diff