Page 1 of 1

Help with some concepts

Posted: Wed May 12, 2010 5:01 am
by Avishaiozeri
Hi guys, i need some help. After programming in C++ for a while, I decided to start with SDL. So i bought "Focus on SDL" (I think its the only book on this subject) and began learning. All went well, but i ran into some graphical concepts i didn't really knew, and the book didn't explain them at all. So i decided to leave SDL and C++ for a while, and learn BlitzPlus, for the purpose of learning the way games work first, and then dealing with the technical stuff of SDL... So i started reading "Game programming for teens", And it was nice, and much easier. But, i still don't know exactly what some things mean...
So, can someone tell me what does "Buffer" mean, and what does it do? And what is the "Back buffer"? and what does people mean when they say to "Flip" the buffer, and stuff like that? can someone tell me, or is there some book that talks about those things? And if someone has advice on what approach do i need to take to learn those things i'll be glad to hear them :) .

Thanks.

Re: Help with some concepts

Posted: Wed May 12, 2010 5:57 am
by zeid
what does "Buffer" mean, and what does it do?
http://en.wikipedia.org/wiki/Data_buffer
What you are likely refering too when you mention "Flip" the buffer is this;
http://en.wikipedia.org/wiki/Double_buf ... _buffering
Basically when displaying the final image with regards to graphics you use two buffers. You write all the pixel data of the frame on to the back buffer which is not being shown, once it is completely updated you switch which buffer is being shown and which is being written too. The reason for doing this is that if you only use one buffer and show the buffer it won't have finished being written too, so you get "image tearing" where image data is being drawn at incorrect times i.e. half the image is from the new frame and the other half is being displayed from what was meant to be the previous frame. I think that all makes sense and is accurate it was a little rushed, so sorry if not.

Re: Help with some concepts

Posted: Wed May 12, 2010 6:19 am
by Avishaiozeri
So you say that the buffer and the back buffer are like two sides of a paper, and every time the engine draws the frame on the back side of the paper, and then "flips" it, and the frame is being shown, and then it draws again at the back and flips it repeatably? that makes sense, thanks for the help.
I read the wiki you'v sent, so buffers aren't used only for graphics?

Re: Help with some concepts

Posted: Mon May 17, 2010 8:20 pm
by Bullet Pulse
Avishaiozeri wrote:Hi guys, i need some help. After programming in C++ for a while, I decided to start with SDL. So i bought "Focus on SDL" (I think its the only book on this subject) and began learning. All went well, but i ran into some graphical concepts i didn't really knew, and the book didn't explain them at all. So i decided to leave SDL and C++ for a while, and learn BlitzPlus, for the purpose of learning the way games work first, and then dealing with the technical stuff of SDL... So i started reading "Game programming for teens", And it was nice, and much easier. But, i still don't know exactly what some things mean...
So, can someone tell me what does "Buffer" mean, and what does it do? And what is the "Back buffer"? and what does people mean when they say to "Flip" the buffer, and stuff like that? can someone tell me, or is there some book that talks about those things? And if someone has advice on what approach do i need to take to learn those things i'll be glad to hear them :) .

Thanks.
You should really read up to about chapter 4 in Focus on SDL, and then start making things with the book as a reference.
It's not easy learning, but start out with something that you can make quickly like Pickin' Sticks.
Try to stick with the multipurpose language (C++) if you are really interested in programming, but if you just program once and a while then you may want to use something easy like BlitzPlus.
There's a learning curve that comes with all programming things and you just have to keep learning more every chance you get.
Good Luck

Re: Help with some concepts

Posted: Tue May 18, 2010 4:23 pm
by eatcomics
and the best way to learn is experience, the more you code, and the more things you try, the more experience you get. And if you ever get stuck really bad, we're right here :D

Re: Help with some concepts

Posted: Wed May 19, 2010 5:34 pm
by Avishaiozeri
thanks! :)