private void glControl1_Paint(object sender, PaintEventArgs e) { if (loaded) { if (renderByTextures) { if (needReload) { view.generateTextureImage(currentLayer, minValue, minValue + width); view.Load2DTexture(); needReload = false; } view.DrawTexture(); glControl1.SwapBuffers(); } else { view.DrawQuads(currentLayer, minValue, minValue + width); glControl1.SwapBuffers(); } } }