Project

General

Profile

« Previous | Next » 

Revision 1942537e

Added by Leszek Koltunski over 7 years ago

Major restructuring with DistortedTexture. One now is able to create Textures anywhere, even from a thread which does not hold the OpenGL context. Same for DistortedFramebuffers.

View differences:

src/main/java/org/distorted/library/DistortedObjectTree.java
86 86
  
87 87
  private void drawRecursive(long currTime, DistortedFramebuffer df)
88 88
    {
89
    mTexture.createTexture();
90

  
89 91
    if( mNumChildren[0]<=0 )
90 92
      {
91 93
      GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTexture.mTextureDataH[0]);
......
147 149
    {
148 150
    ArrayList<Long> ret = new ArrayList<>();
149 151
     
150
    ret.add( mNumChildren[0]>0 ? mTexture.getBitmapID() : mTexture.getID() );
152
    ret.add( mTexture.getID() );
151 153
    DistortedObjectTree node;
152 154
   
153 155
    for(int i=0; i<mNumChildren[0]; i++)
......
167 169

  
168 170
    if( otherNodesPoint ) mData.numPointingNodes--;
169 171
    else                  mMapNodeID.remove(oldList);
170
   
172

  
171 173
    NodeData newData = mMapNodeID.get(newList);
172 174
    
173 175
    if( newData==null )
......
224 226

  
225 227
///////////////////////////////////////////////////////////////////////////////////////////////////
226 228
// Debug - print all the Node IDs
227
/*
229

  
228 230
  void debug(int depth)
229 231
    {
230 232
    String tmp="";
231 233
    int i;
232 234

  
233 235
    for(i=0; i<depth; i++) tmp +="   ";
234
    tmp += (""+mData.ID);
236
    tmp += (mData.ID+" (nodes: "+mData.numPointingNodes+")");
235 237

  
236
    android.util.Log.e("node", tmp);
238
    android.util.Log.e("NODE", tmp);
237 239

  
238 240
    for(i=0; i<mNumChildren[0]; i++)
239 241
      mChildren.get(i).debug(depth+1);
......
253 255
      android.util.Log.e("NODE", "key="+key+" NodeID: "+tmp.ID);
254 256
      }
255 257
    }
256
*/
258

  
257 259
///////////////////////////////////////////////////////////////////////////////////////////////////
258 260
// PUBLIC API
259 261
///////////////////////////////////////////////////////////////////////////////////////////////////
......
275 277
    mNumChildren[0] = 0;
276 278
   
277 279
    ArrayList<Long> list = new ArrayList<>();
278
    list.add(queues.getID());   // TODO: this should depend on both texture and queues! Maybe even on grid as well
279
      
280
    list.add(mTexture.getID());
281

  
280 282
    mData = mMapNodeID.get(list);
281 283
   
282 284
    if( mData!=null )
......
286 288
    else
287 289
      {
288 290
      mData = new NodeData(++mNextNodeID);   
289
      mMapNodeID.put(list, mData);  
291
      mMapNodeID.put(list, mData);
290 292
      }
291 293
    }
292 294

  
......
469 471
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
470 472
    markRecursive();
471 473
    drawRecursive(currTime,Distorted.mFramebuffer);
474
    DistortedFramebuffer.deleteAllMarked();
475
    DistortedTexture.deleteAllMarked();
472 476
    }
473 477

  
474 478
///////////////////////////////////////////////////////////////////////////////////////////////////
......
483 487
    df.setAsOutput();
484 488
    markRecursive();
485 489
    drawRecursive(currTime,df);
490
    DistortedFramebuffer.deleteAllMarked();
491
    DistortedTexture.deleteAllMarked();
486 492
    }
487 493

  
488 494
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff