# how to draw a 2d view of the view frustum?

This topic is 4887 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello! I am currently working on a quadtree and viewfrustum culling. I however want to be able to draw a 2d top-down view of the tree and the frustum. The tree is easy since its just a grid of rectangles. But the view frustum is harder since i need a way to calculate which lines to draw. So what i need is a way to calculate the 2d lines that should make out the top view of the frustum. Iv just gotten into planes and i cant see how i would extract the lines to draw from them, and i was thinking maybe someone else had already done something similiar? I think that maybe i can just throw away the planes y coordinate to get 2d lines instead of planes.. or something like that maybe? this is what my plane&frustum looks like:
	struct plane_t
{
float		m_distance;
vector3d_t	m_normal;
};

struct frustum_t
{
plane_t m_left_plane;
plane_t m_right_plane;
plane_t m_top_plane;
plane_t m_bottom_plane;
plane_t m_near_plane;
plane_t m_far_plane;
};

// i want do do something like this:
void draw_frustum(const frustum_t& frustum, float scale);


I dont know if i explain so you understand so i have made a picture where i have painted what i want to do onto the 2d presentation of the quadtree: http://hem.passagen.se/storage/view.gif Thanks in advance!

##### Share on other sites
I assume you're trying to draw a map on the screen, letting you see where it is you're going.

Anyway, there's 2 ways to go about it.

1: Re-draw it top down, over the top of everything else, only scaled down
2: Draw it top down, but render it to a texture, then render the scene, and draw the texture (scaled down) over the top.

The 2nd way's a little slower, but just like in the other thread where they were talking about portals, you can apply cool effects to it and such. ;)

• 17
• 10
• 19
• 14
• 19