I am developing an OpenGL application (mostly 2D Ortho) compiled in gcc.

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 but found it impossible to work with. In my first experiment, 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 used TightVNC on a windows computer and got different results. In that case, It showed the program correctly, but it would not redraw any further unless I moved the window on the vnc server. 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 will be in full screen mode and that still wont cut it.

I would like to add that I am also using the SDL library for keyboard/mouse and a few other facilities.

This is a very simplified piece of my main loop drawing 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 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.

Dani AI

Generated

Short, practical summary for (and a follow-up to ): the symptoms you describe (server monitor looks correct, VNC shows scrambled tiles or only updates when the window is moved) are classic for hardware‑accelerated OpenGL using direct rendering / page‑flips. Many VNC servers just sample the X framebuffer (or rely on the X DAMAGE hints) and miss GPU scanout/page‑flip updates, so you get partial/stale tiles or no redraws. (virtualgl.org)

Best, reliable fix: run the OpenGL work through VirtualGL and use TurboVNC (VirtualGL does the GPU render and produces regular images; TurboVNC is optimized for sending them). Typical server workflow is: start a TurboVNC desktop, then launch your app with vglrun so the GL renderbacks are captured and sent correctly. Example (paths may vary by distro):

/opt/TurboVNC/bin/vncserver :1 -geometry 1920x1080
# inside the VNC desktop terminal:
/opt/VirtualGL/bin/vglrun /path/to/your_app

This gives correct, tear‑free remote OpenGL output (and far better interactivity than plain VNC). (virtualgl.org)

If you must attach to the real display (very light setup) try x11vnc with damage disabled and client caching as a diagnostic. For many drivers -noxdamage fixes the “no updates unless the window is moved” behaviour because it forces polling instead of trusting X DAMAGE. Example:

x11vnc -display :0 -noxdamage -forever -shared -rfbauth /path/to/passwd

Expect higher CPU/readback load; this is a pragmatic, lightweight workaround but not ideal for high‑frame‑rate GL. (mankier.com)

Quick checks and other workarounds: verify what renderer you’re using with glxinfo | grep "OpenGL renderer". As a diagnostic you can force CPU/software rendering (slow but exposes whether the problem is GPU/pageflip related) with LIBGL_ALWAYS_SOFTWARE=1 ./your_app. Use these to decide between VirtualGL (best) or x11vnc/software fallbacks. (manpages.debian.org)

Notes: No extra “screen redraw message” call after SwapBuffers will reliably fix driver page‑flip behavior — the correct solutions are at the capture layer (VirtualGL/TurboVNC) or by disabling GPU overlays/software‑render fallback as shown above.

Tried nomachine's NX Terminal Server. In my experience it's better than vnc. It's also secured and there is an optimization for low bandwith links. Client is free for windows and linux. Server is also free for linux and solaris. There's also google code for server neatx. Works great but has a few bugs. I can recommend TeamViewer for Linux. It's under wine but works perfect.

Thanks for your reply shukalo83. I will try those when I get the chance.

How "thin" is the nomachine server? I like VNC server because of its low resources and simple installation. The computer I am putting the server on is very light running a simple copy of Xorg and one single application. I don't like the idea of using Wine because this server has no other program running and no window manager, and its essentially inefficient on this setup.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.