| View previous topic :: View next topic |
| Author |
Message |
everlasting
Joined: 19 Mar 2007 Posts: 41
|
Posted: Mon Jun 11, 2007 1:36 pm Post subject: display context doubt |
|
|
I have been working on the Text sample from the sdk, and i've take a look to other GU samples. One of the things i do not understand is that it seems to be two display contexts. By doing swapbuffers you print the screen and go back to the previous context which might be different from the last one.
This means that you have to print the same thing at least twice in order to have the same info in both contexts. At least this is what i have understood, but i can't see the usefulness of this.
I would like to get deeper into GU module, therefore if anyone could supply any info or links i'd be grateful.Thanks |
|
| Back to top |
|
 |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Mon Jun 11, 2007 4:23 pm Post subject: |
|
|
| You write to only one buffer at once.You can't write to the currently displayed buffer.You draw on the second one,and then you swap them.Then,the display buffer becomes the second one(non-visible),and vice-versa.But that's true that you should draw everything again after every buffer swap. |
|
| Back to top |
|
 |
everlasting
Joined: 19 Mar 2007 Posts: 41
|
Posted: Mon Jun 11, 2007 11:11 pm Post subject: |
|
|
i knew you only write in only one buffer each time (i´m spanish so may be i didn't explain myself very well), but i didn`t know that is not possible to write to the displayed buffer. So you have to worry about 'copying' every modification you do in the non-visible buffer to the visible one after swapping haven't you?.
Thanks a lot your explanation was very usefull. |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Jun 11, 2007 11:39 pm Post subject: |
|
|
Read here for info on doublebuffering: http://en.wikipedia.org/wiki/Double_buffering
Also, you CAN draw to the displaybuffer. However, normally you should avoid that, because when the drawing is slow (or you are drawing a lot), the single drawing steps can be seen. That's why double buffering is used.
Also, a swapbuffer call doesn't change the context. It merely swaps draw and display buffer (page flipping).
If you don't understand why you have to repeatedly draw things on the screen, then you should start researching how basic drawing loops work, since this is common approach around all computer graphic applications. _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
everlasting
Joined: 19 Mar 2007 Posts: 41
|
Posted: Tue Jun 12, 2007 3:01 am Post subject: |
|
|
| thanks raphael, good info. |
|
| Back to top |
|
 |
|