SDL / OpenGL not playing nice with VNC

I am developing an OpenGL application (mostly 2D Ortho) compiled in gcc. I am using the SDL library for keyboard/mouse and a few other facilities.

As a requirement, in order to offer remote online tech support for the application, I need to be able to view and control this application remotely from time to time using something like VNC viewer.

I tried using vnc with the application running in a stripped down Xorg with no window manager and found it impossible to work with. I was able to view the remote computer but it was absolutely impossible to use because the vnc server was sending random blocks of random snapshots of various stages of frame redraw, so you would see blocks of objects that are supposed to be hidden by other objects, or blackness from the initial clear screen command, and other strange things. Yet on the vnc server monitor, everything looks fine.

I also ran the same application on a fully loaded Ubuntu installation and got different results. In that case, vnc server sent the initial screen correctly, but it would not redraw any further unless I moved the window on the Ubuntu system. So I would have to click something, move the window, click something else, move the window… etc. That won’t work because the target computer needs to be a simple Xorg system.

This is a very simplified piece of my main loop drawing code:

Code:

for (;1;) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

 Draw();

 SDL_GL_SwapBuffers( );

}

I’m guessing that maybe I need to send a message to linux telling it that the screen has redrawn right after the SDL_GL_SwapBuffers function. If so, I don’t know what that function is or how to go about it.

Or is what I am doing correct? Maybe it is a setting in VNC server that I need to change. Maybe VNC server is the wrong program to use for this.

Thanks in advance for your help guys.