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:

Code :
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.