Best Way to Texture Merged Geometries?


I am converting many cubes may or may not share faces into a single mesh (chunk rendering).

I remove all indices of triangles that our not on the the outside faces of the combined cubes mesh. Can I remove all vertices that are not on the corners of the new mesh and still render the texture in a tiled format? Would I need to have separate textures for each side of the cube face, draw each face of the combined cubes mesh separate from each other, and then tile each face with side exclusive textures? (what is the capability and nature of GL_REPEAT?)

Or should I keep all outer vertices in the combined mesh, buffer the same texture coordinates for each respective vertex buffered, and be satisfied with eliminating all inner vertices?

opengl only renders “primitives”, not “vertices”. for example, GL renders a triangle if you provide 3 vertices. your 3D mesh (“chunked” together or not) has to be made up of triangles, or other primitives. that means, if you want to chunk together 2 intersecting cubes, you have to calculate the edges where they intersect, and then subdivide intersecting primitives. those primitives who are within the geometry, can be removed (if everything is non-transparent), the other primitives remain. texturing isnt the problem, the problem is to calculate new vertices (including their texture coordinates) for subdivided primitives and to determine if a primitive is totally within the geometry, another thing to consider is to verify if the geometry is completely closed by primitives.

example: a triangulated cube’s corner is a bit within the center of another triangulated cube’s face (triangle). that means in order to “eliminate” corner the vertex within, you have to calculate 3 other vertices that cut off the corner vertex. not only that, to close the geometry again, you have to add (i think) 6 new faces. so if you goal is to improve performance, thats not really beneficial …