Terrain tessellation in chunks?


Is there any possible “very fast” way to create mapchunks for tessellation?

I have some pre-alpha ver, but it’s laggy, because I’m using glTexImage2D to port heightmap to shader. There it’s laggy problem.
Do you know anyone better solution? Or it’s very old technique using map chunks? And what I’m doing? 3D Map Editor, that’s why is better use more chunks than one big map for more textures.

Program class hiearchy:
-> MapChunk
-> MapTile(16x16 MapChunk) -> MapTile::draw call MapChunk::draw Vertex Array Object ==> glDrawArrays
-> World (max 64x64 MapTile, currently using one MapTile) -> World::draw foreach MapTile do MapTile::draw
-> MapView (QGLWidget) -> MapView::paintGL call World::draw
-> MainWindow setCentralWidget

Thanks for any reply!

No one have any idea?

When I use 4x4 MapChunk its still good, but 8x8 is little laggy, 16x16 ultra laggy.

Function which lagging it is:

void Material::bind()
    m_shader->bind(); // QOpenGLShaderProgramPtr == typedef QSharedPointer<QOpenGLShaderProgram> QOpenGLShaderProgramPtr; its binding shader...

    foreach(const GLuint unit, m_unitConfigs.keys())
        const TextureUnitConfiguration& config = m_unitConfigs.value(unit);

        // Bind the texture
        m_funcs->glActiveTexture(GL_TEXTURE0 + unit); // m_funcs = QOpenGLFunctions, its in Qt.. working as normal glActiveTexture BUT there come slow down

        // Bind the sampler

        // Associate with sampler uniform in shader (if we know the name or location)
            m_shader->setUniformValue(m_samplerUniforms.value(unit).constData(), unit); // BIGGEST SLOW DOWN because it sending a lot uniforms, any idea how to post uniform with multi values fast?


I have new result from debugging.

Big enemy is still same = uniform. But not caused by textures, it slowed because each chunk in (16*16 = 256) use mapData[MAP_WIDTH / 16 * MAP_HEIGHT / 16 * sizeof(float)] which is binded to texture (glTexImage2D) and there is main problem, sending 256 uniforms per 16ms is alot! Have you any idea with better solution how to send through uniform 256 mapData (256 mean each chunk) (mapData == buffer with height).