octree like data structure and sorting

Hello,
for my rendering purpose I actually don’t need a reak octree, just a lot of regular boxes. For sorting them front to back I thought about to compare the dot products of the boxes center and the view vector and then sort the dot products from small to large. I tried it on a piece of paper with 8 boxes and 27 boxes and it seems to work.

I can imagine to do kind of pre-sorting. For 3 axis I have 8 case of the viewing vector. e.g. x>=0, y>= 0, z>=0, etc.
I want to create indices that I can use to access the
correct index buffer (vbo+ibo) for rendering the boxes in the desired order.

Anybody gained epxeriences with this kind of sorting ?
May it work ? May it not work ?

regards,
lobbel

Solved

regards,
lobbel