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)&&(STerrain[QUAD_ID].zpos<=z+RANGE)) { return TRUE; } else return FALSE;
}