PDA

View Full Version : quadtree / frustum help



nomad82
01-27-2003, 05:05 AM
http://www.gamedev.net/community/forums/topic.asp?topic_id=135594

no one there has been able to answer my
question...and was hoping someone here can.

you can post / reply here or there.

thanks.

Ysaneya
01-27-2003, 08:01 AM
A wrote some code to show the frustum on screen a few months ago. It uses gluUnproject, but it might help you..

Here it is: http://www.fl-tw.com/opengl/frustum.txt

Y.

rgpc
01-27-2003, 01:23 PM
Personally I don't pretend to understand the code you posted but I do wonder why it is (perhaps someone else can answer this) that when you get the four sides of the frustum (l,r,t,b) the calculations don't appear to have common points between say the left and top sides?

I would have thought that if you generate the left & right then the top would be the upper points of the left & right and the bottom would have been the lower points.

Eg. You have for your left side...


TE_Frustum[1][0] = TE_clip[ 3] + TE_clip[ 0];
TE_Frustum[1][1] = TE_clip[ 7] + TE_clip[ 4];

and for your top side...


TE_Frustum[2][0] = TE_clip[ 3] + TE_clip[ 1];
TE_Frustum[2][1] = TE_clip[ 7] + TE_clip[ 5];

To me these code snippets should essentially be the same or you could up with an open (or overlapping) shape to your frustum (but that could be my lack of understanding of how Opengl constructs the frustum/matrices...

Having said all that have you looked at the suggestion posted by mrbastard? Draw your bounding volumes (without clipping) and step through the code that clips out the missing volume to see if there's anything wrong there.

nomad82
01-28-2003, 08:32 PM
rgpc: I (sadly) do not know also why this is, i just use the code found on www.markmorley.com. (http://www.markmorley.com.)

ysaneya: thanks, i'll read the code... http://www.opengl.org/discussion_boards/ubb/smile.gif.


how does the others here do frustum culling? can i see a copy of your code? thanks!