View Full Version : what are the use of back and front buffer?
05-26-2004, 11:22 PM
can someone tell me what are the use of back buffer and front buffer? I wondered if I could use them for double-buffering. Now I know I can't. So for what are they useful? Have you some examples?
Thanks in advance for helping me understanding OGL!
You use the front and back buffer with double buffering. You draw to the back buffer and show the front buffer on the screen, and when the back buffer is complete, you swap the buffers and the old back buffer is now shown on the screen.
I will also answer your question in the other thread here, as it's basically the same question asked in different ways (altough you may just not have realized it, so no problem with it). Buffer management is not provided by OpenGL, it's provided by the platform dependent glue layer between OpenGL and the operating system. Therefore it's impossible to do ANYTHING directly in OpenGL, without using the windowing system. Without the windowing system, you can't create the buffers and rendering context needed for OpenGL to work.
So in short, double buffering IS possible, but not directly in OpenGL. And the reason is that OpenGL does not provide the necessary functions for create and swap the double buffers. That is up to the glue layer to provide.
Check out this (http://nehe.gamedev.net) place for great tutorials on OpenGL. They create double buffered applications, and the code is available for loads of platforms.
05-27-2004, 12:48 AM
So the windowing system uses these buffers for double-buffering but we can't use them for double-buffering directly in OGL (if I have understood your answer). Is there a utility of these buffers in OGL directly?
The windowing system manages the buffers (creates them, resize them when needed, swaps them when you say so, and so on), and OpenGL renders to them.
If this is not what you mean by "using them directly in OpenGL", then what do you mean?
05-27-2004, 01:53 AM
I just want to know if these buffers are used for something else that double-buffering, in the frame of gl and glu (not glut, wgl or glx). There is a glDrawBuffer function. What is the utility of a glDrawBuffer(GL_FRONT or GL_BACK) call?
05-27-2004, 02:06 AM
Like Bob said, you can't create the buffers and rendering context needed for OpenGL to work.
An example of the glue layer Bob refers to is glut. It allows you to specify the attributes of the window that opengl will be drawing to. Here you can initialize a window that supports alpha values, depth buffer, double buffering, etc.. depending on what your application needs.
Once you have initialized this window with double buffering, you can access the back and front buffer by using gl commands like
They select the buffers you want to draw to and where you want to read from respectively.
The swap-control of this double buffered window is also part of the glue layer (e.g. glutSwapBuffers())and cannot be done by an opengl command.
05-27-2004, 02:20 AM
Thanks Bob and NiCo!
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.