Picking the Actor by using color picking technique in C++

Hi, I am making a voxel game and i want to place the block depending on the side of the block i clicked on. I was doing similar using Color Picking technique in OpenL C++ this way:

  1. find the location of the block I clicked on
  2. in its place I draw a color block (each face has its own color parameter)
  3. then, with the help of obtaining the color under the mouse, he determined which side was pressed.

At the same time, the color block is not visible during the game, all this happens between the final rendering of the frame. Is it possible to do the same here?

Here is example how it to do with OpenGL: Picking with an OpenGL hack