Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What glutswapbuffers actually did?

Tags:

c++

opengl

glut

Does the front buffer pointer now points to the back buffer?Or the front buffer content was updated by the back buffer's?If that is the case,whole block of the content is updated or only the changed content is updated?

The description of glutswapbuffers on opengl.org is

Performs a buffer swap on the layer in use for the current window. Specifically, glutSwapBuffers promotes the contents of the back buffer of the layer in use of the current window to become the contents of the front buffer. The contents of the back buffer then become undefined.

What does the last sentence means?the back buffer now points to null?

like image 794
Jabutey Ng Avatar asked Jun 13 '12 10:06

Jabutey Ng


2 Answers

The contents of the back buffer then become undefined.

What does the last sentence means?

It does mean, that after the swap the contents of the back buffer may be everything. It may be the front buffer, random data, a picture of you on vacation, whatever. It's not defined and you should make no assumptions whatsoever about it.

like image 171
datenwolf Avatar answered Sep 28 '22 08:09

datenwolf


This means, that glut does not guarantee that after back buffer becomes front, that buffer that is now back will be something meaningfull, like if you suppose it to contain that information, that previously was in "old" front buffer. I suppose, it's made so, because otherwise you would need third buffer to swap buffers in that way, which is unacceptable in high-perfomance 3D

like image 44
JustSomeGuy Avatar answered Sep 28 '22 09:09

JustSomeGuy