So I'm making a voxel engine with lwjgl. Every entity is composed of a bunch of voxels. I'm wondering which of the following two methods is more efficient for moving around/rotating an entity (Or if there's a better method.)

Method 1: An entity has x, y, and z variables that I can change to move it around. These variables will be used for the offset of every voxel that the entity is composed of. The render function calculates where every quad of every voxel will be based on the x, y, and z variables of the entity. Upside: I can move the entire entity around by simply changing the x, y, and z variables. Downside: Many, many quad positions will have to be calculated every single render function!

Method 2: All the voxel quads of an entity are loaded into a display list when the game starts. I can move the entity around using glPushMatrix(), glTranslatef(), and glPopMatrix(). Upside: This means that the program doesn't have to do all those calculations every frame. Downside the voxel positions in the display list are fixed, so I can only move the entity around by pushing and popping the matrix. I heard that having to do this for every entity is a bad Idea.

I'm not even sure If everything I said is true, so correct me if I said something wrong, and I'll edit the post. 3D is a lot more confusing than 2D! Anyways, which method is more efficient? Are there other methods that might work better? Thanks!

This all depends on the ratio between vertices and objects. If each object has very few vertices the OpenGL matrix calls will be a bottleneck, but if you have many vertices per object it's obviously faster to let OpenGL handle the translating. One of them depends on the number of objects, the other one on the total number of vertices. Also note that if you only have a handful of objects any of the two will be fast enough of course.

This is a known performance bottleneck, and is solved in a number of other ways too, depending on what you're drawing.

There's been alot of recent research on voxels. If you want ignore that and keep it simple, then leave the voxel model alone (in model space) and move the camera to reflect it's relative world position.

There will be many more vertices than there are objects. For example, each voxel has 24 vertices (I realize this isn't the most efficient way to do it.) and my player object is composed of 94 voxels (And that's after I hollowed out the inside of him!) And I don't plan to have too many objects on the screen, so it sounds like the matrix calls would be best then, right?

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org