display a cube inside another bigger cube

Hi,

Is it possible to display a cube inside another bigger cube easily? I tried to disable the depth when rendering the smaller cube. I can see the smaller one in this way. But since the depth test is disabled, the smaller one has its font and back faces messed up.

Another solution may be applying some transformation? Please help. Thanks.

Tony

This isn’t an advanced topic.

Look up glCullface and draw your smaller cube first (assuming you don’t want your outer cube to be transparent - in which case you should set your colours to include alpha < 1, enable blending and draw your small cube first)

How about just clearing the depth buffer between cubes?

glClear(GL_DEPTH_BUFFER_BIT);

Originally posted by dorbie:
[b]How about just clearing the depth buffer between cubes?

glClear(GL_DEPTH_BUFFER_BIT);[/b]

That might not achieve the desired result (but then again it might). It would make the smaller cube look like it’s floating in front of the bigger cube. If the result is to make the smaller cube look like it is inside the larger (ie. like looking down into an open box) then culling is the best way to go…