QMutexLocker lock(&m_mutex);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if ( !newBit ) {
GLuint texture;
// allocate a texture name
glGenTextures( 1, &texture );
// select our current texture
glBindTexture( GL_TEXTURE_2D, texture );
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, m_image.width(), m_image.height(),0,GL_LUMINANCE, GL_UNSIGNED_BYTE, m_image.bits());
//glDrawPixels(m_image.width(), m_image.height(), GL_LUMINANCE, GL_UNSIGNED_BYTE, m_image.bits());
}
glBegin( GL_QUADS );
glTexCoord2d(0.0,0.0); glVertex2d(0.0,0.0);
glTexCoord2d(1.0,0.0); glVertex2d(1.0,0.0);
glTexCoord2d(1.0,1.0); glVertex2d(1.0,1.0);
glTexCoord2d(0.0,1.0); glVertex2d(0.0,1.0);
glEnd();
if (!newBit)
glDeleteTextures( 1, &texture );