OpenGL portal examples/tutorials?

I am trying to make a game with OpenGL. It is based on some 2D maze code. The algorithm that makes the maze fills out an array of longs, setting bits that tell the drawing routines whether the current cell(array element) has a wall, door or empty space(perfect for a portal ) on each side. Converting this to 3D is very simple. All the 3D drawing routine has to do is go through the array and draw walls. This is very slow.

I thought about using ray casting, but the code that I came up with is too slow and any code that I found uses assembly(I do not understand assembly).

What I need to know is if there are any OpenGL portal tutorials and/or examples (with working code! ) out there? I have not been able to find any. While I understand how portals work, I have trouble putting theory to code.

I am using an iMac with CodeWarrior C/C++. This should not be a problem since OpenGL is cross platform, but this is important info anyway.

Thanks in advance,
Mark Speir

How big is the maze? And are you getting
hardware accelleration on that iMac? If
you’re running in software, you may never
get the performance you want. If it’s
hardware, it’s not hard to draw a 2D maze
as 3D tunnels.

Depending on the size of the maze, you may
wish to start by just drawing the entire
maze (tunnel system) with no culling, and
see if it’s fast enough. If the maze is, say,
60x60 or less there should be no problem
even if you have only sluggish hardware
triangle fill.

From there, you can start looking into things
like bsp trees, portals, or culling. There
are many tutorials on those things around;
try http://www.flipcode.com/ or http://nehe.gamedev.net/ (or, perhaps, even
some of the links on this site).

PS: walking through a 2D tunnel system was
the first thing I did in OpenGL, so I know
where you’re at :slight_smile: You really REALLY have
to read up on 3D algebra and matrix
operations, though; if you don’t have it
solid in your mind, writing the code will be
too hard.

Well, the maze starts out small, about 5x5 cells. Each new ‘level’ get larger. So while the first, lets say, 3 levels could be drawn without culling, after that it will get far too big. There are also going to be 3D objects through out the mazes so culling is a must, even in small levels.

I’ve played aroung with BSP’s before, but all this does is sort the polygons. I would still be drawing all of the polygons in the maze.

Portals look like the way to go any I will check out those links.

If anyone else knows of some examples or tutorials, please reply.

Thanks,
Mark

P.S. The iMac has built in hardware accelleration. It uses the Rage Pro or Rage+ or Rage II or something. Sucks, but is better than software rendering.

Check the tutorial from Ahmad kabani on Underground Mine at http://www.spinningkids.org/umine

You should find the link in the main page.

Bye bye…

I may be off base here, but if you’re dealing with a 2D array you might want to consider using a Quadtree instead of a BSP tree.

Toom