2D 120hz programming?


I’m an almost absolute beginner to openGL programming, but I have to use it and wonder it can provide the solution.

I want to display 2D image at 120hz on the monitor (in fact, a 120hz/3D-ready projector).
I have a few questions related to this.

  1. Is the programming significantly different from 2D at 60hz?

  2. If so, should I use 3D-stereo APIs (I want to avoid)? Or is it just parameter setting issue and others are the same as 2D at 60hz?

  3. If there is no difference in programming, do I only need to open OS(windows or linux) control window and set display and graphics card to 120hz?

  4. Finally, are all 3D supporting graphics cards (decent NVidia cards) capable of handling 120hz? And are all 120hz/3D-ready projectors capable of showing 2D at 120hz?

BTW, my requirement for the resolution is very little. 600x600 is enough. I’m also curious if this is possible/impossible with VGA connector or HDMI or DVI.

Thank you so much.

Things like control over the monitor refresh rate are outside the scope of OpenGL, off-hand I don’t know how to control that from an application.
For a single 2D image there does not seem much point in displaying it with 120Hz [1], however, if your image is in fact a pair of stereoscopic images (one for the left, one for the right eye) you can use OpenGL’s quad-buffer stereo to render them. Note that quad-buffer stereo is only supported on Nvidia’s Quadro cards, not the consumer GeForce models - I know there are games that run in stereo mode on consumer cards, but AFAIK that requires explicit support in the graphics driver.

  1. I’m not sure I fully understand what you are asking about. As far as OpenGL is concerned the main difference is that you have two back buffers (one for each eye) into which you render your scene (usually with slightly different projection settings to get the depth perception).

  2. The only way I know to access the 3D mode is through quad-buffer stereo. There might be other ways that I don’t know about.

  3. You need to render to the two different back-buffers, so it’s not terribly difficult, but there is a difference in programming.

  4. see above, you need a Quadro card; same with AMD cards you need a FireGL one to get quad-buffer support.

[1] it may help if you could explain what you want to achieve.

Assuming you do just want a single 2D image rendered at 120Hz, that’s pretty simple, and pretty well any GPU should be able to handle that.

As far as configuring your GPU to scan out at that rate… In this day-and-age, nearly all monitors can tell the GPU/display driver what scan-out modes they support via protocols such as DDC. In the absence of this, you need to lookup the scan-out specs, and feed those to your display driver (how depends on your OS).

Once you have these configured, your GPU can switch to the appropriate scan-out mode. Each time it scans out a screen, there’s what’s called a Vertical Blanking Interval (VBI), and GPUs can be told to synchronize their “buffer swaps” (e.g. glXSwapBuffers/wglSwapBuffers) to that VBI. This is called vertical synchronization (vsync). Activate that via your driver control panel (or other driver-specific method). This is supported regardless of your connector/cable type.

Then you basically just draw a screenful, and call SwapBuffers and glFinish(). When that’s done, repeat the process. This will lock your drawing code at 120Hz (assuming you’ve activated a 120Hz video mode and vsync). For smooth refreshes, use double buffering (allocate a double-buffered system framebuffer in your application).

@Dark Photon
That’s exactly what I wanted to do. (3D objects, but NOT 3D stereo-vision of 2x60hz, but just 2D rendered image at 120hz.)
Thanks a lot.
Have a nice weekend.