private ByteBuffer generateBallTexture(){
  byte[] buf=new byte[TEX_SIZE * TEX_SIZE * BYTES_PER_PIXEL];
  int left[]=new int[TEX_SIZE - 1];
  int right[]=new int[TEX_SIZE - 1];
  computeCircleEdges(TEX_SIZE / 2 - 1,left,right);
  for (int y=0; y < left.length; y++) {
    int xleft=left[y];
    int xright=right[y];
    for (int x=xleft; x <= xright; x++) {
      int offset=(y * TEX_SIZE + x) * BYTES_PER_PIXEL;
      buf[offset]=(byte)0xff;
      buf[offset + 1]=(byte)0xff;
      buf[offset + 2]=(byte)0xff;
      buf[offset + 3]=(byte)0xff;
    }
  }
  ByteBuffer byteBuf=ByteBuffer.allocateDirect(buf.length);
  byteBuf.put(buf);
  byteBuf.position(0);
  return byteBuf;
}

private ByteBuffer generateBallTexture ( ) { byte [ ] buf = new byte [ TEX_SIZE * TEX_SIZE * BYTES_PER_PIXEL ] ; int left [ ] = new int [ TEX_SIZE - 1 ] ; int right [ ] = new int [ TEX_SIZE - 1 ] ; computeCircleEdges ( TEX_SIZE / 2 - 1 , left , right ) ; for ( int y = 0 ; y < left . length ; y ++ ) { int xleft = left [ y ] ; int xright = right [ y ] ; for ( int x = xleft ; x <= xright ; x ++ ) { int offset = ( y * TEX_SIZE + x ) * BYTES_PER_PIXEL ; buf [ offset ] = ( byte ) 0xff ; buf [ offset + 1 ] = ( byte ) 0xff ; buf [ offset + 2 ] = ( byte ) 0xff ; buf [ offset + 3 ] = ( byte ) 0xff ; } } ByteBuffer byteBuf = ByteBuffer . allocateDirect ( buf . length ) ; byteBuf . put ( buf ) ; byteBuf . position ( 0 ) ; return byteBuf ; }
generates the ball texture . this is a simple filled circle in a solid color , with a transparent black background .
