private synchronized void initProjectionData(Grid2D projection) { initialize(projection); if (projection != null) { float[] proj = new float[projection.getWidth() * projection.getHeight()]; for (int i = 0; i < projection.getWidth(); i++) { for (int j = 0; j < projection.getHeight(); j++) { proj[(j * projection.getWidth()) + i] = projection.getPixelValue(i, j); } } if (projectionArray == null) { // Create the array that will contain the // projection data. projectionArray = context.createFloatBuffer( projection.getWidth() * projection.getHeight(), Mem.READ_ONLY); } // Copy the projection data to the array projectionArray.getBuffer().put(proj); projectionArray.getBuffer().rewind(); // set the texture CLImageFormat format = new CLImageFormat(ChannelOrder.INTENSITY, ChannelType.FLOAT); projectionTex = context.createImage2d( projectionArray.getBuffer(), projection.getWidth(), projection.getHeight(), format, Mem.READ_ONLY); // projectionArray.release(); } else { System.out.println("Projection was null!!"); } }