PDA

View Full Version : Terrain Engine - trouble



lsdi
01-28-2002, 06:54 PM
Im a newbie in opengl (math too) and I cant use quadtrees this time, so Im coding my own *thing to make something like it. sorry about my english.... but.. it works like:

all the terrain is height mapped, in 256x256 big quads... this quads together build the terrain, i want to draw just the quads that are in my view area, or more simple, to draw just quads that are RANGE units far from camera... thanks.

code:




bool quad_in_range(int C_XPOS,int C_ZPOS,int QUAD_ID,int RANGE,int SIMPLE)
{
int x=C_XPOS+(C_XPOS % 256); //C_XPOS = CAMERA POSITION ...
int z=C_ZPOS+(C_ZPOS % 256);

if((STerrain[QUAD_ID].xpos<=x+RANGE)&amp;&amp;(STerrain[QUAD_ID].zpos<=z+RANGE)) {
return TRUE;
}
else
return FALSE;

}

Bob
01-28-2002, 11:24 PM
And the question/trouble is?

lsdi
01-29-2002, 06:47 AM
Ops...


The question is

why it isnt works? http://www.opengl.org/discussion_boards/ubb/biggrin.gif sorry

Bob
01-29-2002, 09:22 AM
A few thing you haven't mentioned yet: what happens, what happens that should not happen, what is supposed to happen, what it is that doesn't work, .

Considering how many things can go wrong in an application, I don't even want to take a wild guess untill you explain the problem with more details.