Operations on parts of different arrays

I am doing a raycasting engine and for performance reasons I thought it would be good to use the GPU for many for loop calculations.
Tutorials I found are very scarce and only show manipulation of multiple arrays of same size. I need to convert something like this:

for(int y = drawBeginAux; y < drawEndAux; ++y)
    int texY = static_cast<int>(((y - rdba) * (middleImageHeight * lhfr))) % middleImageHeight;
    int texIndex = (texX * middleImageHeight + (middleImageHeight - texY - 1));

    int index = ((m_ScreenHeight - y - 1) * m_ScreenWidth + x);

    m_ScreenBuffer[index] = middleImageData[texIndex];
    m_ColorBuffer[index] = lightLevel;

Into OpenCL code and I have no clue how. Any help? It does not have to be full ocl code, just point me in the right direction.

With OpenCL you replace your inner loop (or loops, for 2D or 3D cases) with kernels that execute in parallel. So replace your “for” loop with the kernel declaration, and then add “int y = get_global_id(0)” above your code. Many of the fixed variables become kernel parameters, and the screen buffer, color buffer, and image data become OpenCL buffer objects (or perhaps OpenCL image objects.

Check out these fine training videos: http://www.khronos.org/message_boards/showthread.php/9179-OpenCL-YouTube-Training-Videos