Terrain Engine - trouble

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.


bool quad_in_range(int C_XPOS,int C_ZPOS,int QUAD_ID,int RANGE,int SIMPLE)
int z=C_ZPOS+(C_ZPOS % 256);

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


And the question/trouble is?


The question is

why it isnt works? sorry

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.