this can be done but is relatively complicated.

Also, doing this with primitives is different from models - heres how to do it with primitives, including rendering in GS:

first, you need a sort class to store data:
as you read on wikepedia, CSG can be represented by various primitives connected to each other via boolean arithmetic (+ or -).

so, in lite-c we don't have classes, but we can use variables instead.
so, for your example, we would store data for a cube and a cylinder and "link" them together (in C++ you could just make a shape class that has another Shape variable inside), lite-c you'll have to play around :\

when rendering, you have 2 choices - represent your geometry as polygons via dynamically created data, or render s-curves or dots/lines with d3d_draw.

for the first, we can use a recursive subdivision routine that will base its starting values on the intersection points between the two shapes. Check our ray-line intersection equations for this. So, you will create a list of vertices by analyzing each point on the parent shape. if the said point is intersecting with the child shape, you replace the intersection volume location with the equation for the child shape and continue. The result will be a highly tesselated model that will render via draw_begin and sending the vertices as a vertex buffer to d3d. you could also render each vertex as a point for an easier way of showing the mesh without too much directX knowledge.

if you need more specifics, contact me - I know my explanation is a bit confusing - I don't have enough room or time right now to explain in even more detail.

ps, intersecting 2 models can be done in the same way but using ray-polygon intersection and testing every polygon against the sample point (its slow but this is the easiest way to implement).

-Mike-


http://www.groundtacticsgame.com/
Alienware m17x R Custom laptop
specs:
Intel Core 2 Extreme Quad CPU Q9300
2x Nvidia 280GTX 2GB vram
6GB ddr3 memory@ 1333Mhz
512GB SSD
1200p 17' screen
runs Crysis Warhead on max settings at 1200p at 90 fps