views:

66

answers:

1

I'd like to draw the inside of a box fullscreen (i.e. it should completely fill the viewport) using OpenGL. The box should have perspective.

I presume I'll have to change the dimensions of the box depending on the viewport size but I'm not sure how to go about this.

I'm trying to achieve something like the room in this image

My question is: how can I achieve this?

+2  A: 

Use the same coords for the fronts of the four "wall" quads as you passed to glFrustum. The usual viewport code will work just fine without modification (it's basically just telling OpenGL where to display its output, which you (nearly) always want as the full size of the window you're given). Just be aware that since you're told it to fill the view, you'll get linear distortion when/if the shape of the display area changes (i.e., square window->square box, oblong window->oblong box).

Jerry Coffin