ugluk

10-21-2010, 05:45 PM

I am now a fervent adherent of batching, but I have a problem. Whenever a new frame starts (I'm using glut) something clears the modelview matrix. My batcher thinks the old modelview matrix is still loaded and does not reload it. The consequence of this, of course, is a garbled frame. The code looks something like this:

// if (batch_ptr->matrix_ptr != matrix_ptr)

{

glLoadMatrixf(batch_ptr->matrix_ptr->data());

matrix_ptr = batch_ptr->matrix_ptr;

}

The comment is present, because, to get correct behaviour, I must reload the modelview matrix every frame. Where do the GL or glut specs say that the modelview matrix is to be cleared every frame?

// if (batch_ptr->matrix_ptr != matrix_ptr)

{

glLoadMatrixf(batch_ptr->matrix_ptr->data());

matrix_ptr = batch_ptr->matrix_ptr;

}

The comment is present, because, to get correct behaviour, I must reload the modelview matrix every frame. Where do the GL or glut specs say that the modelview matrix is to be cleared every frame?