* @param sy
   * @return
   */
  private int getTextureIndex(float sx, float sy, float[] uv) {
    if (EWJORDAN) System.out.println("Getting texel at "+sx + ", "+sy);
    //System.out.println("Screen: "+ sx + " " + sy);
    sx = xmult*(sx-(parent.width/2.0f) +.5f);//+.5f)
    sy = ymult*(sy-(parent.height/2.0f)+.5f);//+.5f)
    //sx /= SUBXRES;
    //sy /= SUBYRES;
    float sz = nearPlaneDepth;
    float a = sx * ax + sy * ay + sz * az;
    float b = sx * bx + sy * by + sz * bz;
    float c = sx * cx + sy * cy + sz * cz;
    int u = (int)(a / c);
    int v = (int)(b / c);
    uv[0] = a / c;
    uv[1] = b / c;
    if (uv[0] < 0) {
      uv[0] = u = 0;
    }
    if (uv[1] < 0) {
      uv[1] = v = 0;
    }
    if (uv[0] >= twidth) {
      uv[0] = twidth-1;
      u = twidth-1;
    }
    if (uv[1] >= theight) {
      uv[1] = theight-1;
      v = theight-1;
    }
    int result = v*twidth + u;
    //System.out.println("a/b/c: "+a + " " + b + " " + c);
    //System.out.println("cx/y/z: "+cx + " " + cy + " " + cz);
    //if (result < 0) result = 0;
    //if (result >= timage.pixels.length-2) result = timage.pixels.length - 2;
    if (EWJORDAN) System.out.println("Got texel "+result);
    return result;
  }