# Clip Planes/Regions...

Fayetteville, NC, USA
OK, I got my engine up and running fairly well. However, when too much of the level goes out of the player's view (in any direction) the thing crashes. How can I get it to only draw polygons that the player sees? The engine is in OpenGL and I use nothing but triangles for drawing since they draw the fastest. I can post the drawing routine should you need it.

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]

• It very much depends on the world you are drawing. If its outdoors, rolling landscape type and you mostly on the floor ( car race etc ) , you could split the world a grid and attach groups of polys to each grid square. Or you could use quad/octree method, where the world is recursivly divided into smaller and smaller cubes, until your world cube section contains a maximum poly count. Then check the view frustrum with the cube, if you can see it, roast the poly's to the screen.

http://pages.eidosnet.co.uk/~n.anderson/lod_program.html
http://hpcc.engin.umich.edu/CFD/users/charlton/Thesis/html/node29.html

: OK, I got my engine up and running fairly well. However, when too much of the level goes out of the player's view (in any direction) the thing crashes. How can I get it to only draw polygons that the player sees? The engine is in OpenGL and I use nothing but triangles for drawing since they draw the fastest. I can post the drawing routine should you need it.
: -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]
:

• Fayetteville, NC, USA
OK, dunno' if that's over my head or not. I'll check the sites out, but I have narrowed the problem down to my Voodoo3 2000 PCI card drivers. I compiled my executeable and ran it on mine with the player start far enough out for the entire level to be in view (player is outside the actual level). Now when I walk in close enough or turn left/right far enough and a certain number of polys go off-screen, it crashes. The program also runs like it's on ether or something. I mean you press a key and he jets so fast it's ungodly. Now, I took this same executeable and brought it into my roommate's room and had him test it with his machine (P3/800, GeForce256 I built for him) and it ran at a normal pace and he could walk all over the place with no crashes. The Voodoo DLL that crashes is 3DFXOGL.DLL, and I have almost determined that the crashes happen when a polygon gets to be 90 degrees on either side of the player (or above/below). This leads me to believe that the freaks at 3dfx didn't code in something to ignore polygons that the player can't possibly see, such as one behind him/her. I do have opengl32.dll, but will it work with my video card, and if so how do I tell my video card to use JUST that DLL and not the one that Windows has selected for my card? I need the game engine to run in OpenGL and (later, MUCH LATER), D3D. I don't know anything about Glide programming, nor do I have the sources/libs/headers for it, so I cannot program for Glide right now, but my card DOES support OpenGL. Thanks for the help!

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]

• : OK, I got my engine up and running fairly well. However, when too much of the level goes out of the player's view (in any direction) the thing crashes. How can I get it to only draw polygons that the player sees? The engine is in OpenGL and I use nothing but triangles for drawing since they draw the fastest. I can post the drawing routine should you need it.
: -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]
:

I think glCullFace(GLenum mode) should help (mode takes GL_BACK or GL_FRONT ?? (not sure though), glCullFace allows you not to calculate or render stuffs not on screen.

Maybe that will help.

• Fayetteville, NC, USA
: I think glCullFace(GLenum mode) should help (mode takes GL_BACK or GL_FRONT ?? (not sure though), glCullFace allows you not to calculate or render stuffs not on screen.
:
: Maybe that will help.
:
Thanks, guatam. I will check it out as soon as I finish checking my boards and email. The problem is not with OpenGL however, JUST 3dfx cards. My roommate can run it on his machine perfectly (proper walking pace, go through the whole level, etc). Now when I try it on my machine, which has a Voodoo3 2000 PCI card, it runs fine until a single vertex is 90 degrees to the player's right or left (up/down as well), then 3dfxogl.dll crashes with the error "10H" (clear as mud eh?!). It also wants to run about ten times faster than it should. Obviously, 3dfx ignored OpenGL and concentrated solely on Glide drivers. Is there a way I can force my program to use OpenGl32.DLL instead of a user's default OpenGL driver? If I can then I can assure that the game would run on ANY card that supports OpenGL.

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]

• From what I understand from this disscussion the DLL crashes when some vertex gets behind the player's NearClipPlane(90 deg in any direction) because when the vertex is projected it gets very large screen coordinates or can even get a division by 0 error. You really need to use some function to clip your polygon before drawing it!

: : I think glCullFace(GLenum mode) should help (mode takes GL_BACK or GL_FRONT ?? (not sure though), glCullFace allows you not to calculate or render stuffs not on screen.
: :
: : Maybe that will help.
: :
: Thanks, guatam. I will check it out as soon as I finish checking my boards and email. The problem is not with OpenGL however, JUST 3dfx cards. My roommate can run it on his machine perfectly (proper walking pace, go through the whole level, etc). Now when I try it on my machine, which has a Voodoo3 2000 PCI card, it runs fine until a single vertex is 90 degrees to the player's right or left (up/down as well), then 3dfxogl.dll crashes with the error "10H" (clear as mud eh?!). It also wants to run about ten times faster than it should. Obviously, 3dfx ignored OpenGL and concentrated solely on Glide drivers. Is there a way I can force my program to use OpenGl32.DLL instead of a user's default OpenGL driver? If I can then I can assure that the game would run on ANY card that supports OpenGL.
:
:
: -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]
:
: