What code do you use to initially process the level when it is loaded? I restarted the 3D editor I was making, and this is how I do it:
for(int x = 0; x < JME.width; x++)
for(int y = 0; y < JME.height; y++)
for(int z = 0; z < JME.depth; z++)
//le is a LevelEditor instance
int t = JME.le.level.getTile(x, y, z);
if(t != 0)
I tried a 64x64x64 map, which loaded in a few seconds with no lag. A 256x256x256 map completely overloads my system, and doesn't ever load (I have to switch the power off!)
Is there a better way to do this, or is this an OpenGL-specific problem?
The nested loop isn't the problem, at least not at 64x64x64.
If you want to render them as cubes be sure to use geometry instancing or you will have a *very* tough time getting it to render anything past 100x100x100. If you want to go that way be sure to learn something about shaders, you will absolutely need them for optimizations. Also be sure not to render air tiles and internal tiles.
You could also try to make a polygon mesh from them (this is the minecraft approach) and rebuild only the changed parts - this is far more complicated but also far faster.
And as last option you can use some kind of raytracing/raycasting/isometric rendering - this is what I use in my voxel editor. You'll have to code this from scratch but it will be much more memory friendly.
Other random advice:
-Move as much as possible outside the nested loop.
-Avoid "multiple indirections" such as JME.le.level.getTile(x, y, z); - this won't make any difference at 64^3 but will make a lot at 256^3.
-Avoid method calls inside the loop, inline as much as possible.
Good luck, you'll need it! Making a voxel editor for big volumes is a pretty complicated task. I've been working on mine for over an year and it's still slow on 256^3 and barely usable on 512^3.
Edit: I just realize you said it is realted to loading and OpenGL - be sure to load it to memory (3d array, linear array, svo or something like that) and render it separately. Loading should take a few seconds at most. Don't use class/struct/enum or anything like that to store the tiles, just use a byte and deal with textures/etc when rendering.