• Advertisement

Archived

This topic is now archived and is closed to further replies.

What is a buffer?

This topic is 5095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve been programming games for a little bit, read through some books and everything but what exactly is a buffer? I never really knew.
R.I.P. Mark Osback Solo Pa Mi Gente VG-Force

Share this post


Link to post
Share on other sites
Advertisement
Simply put, a buffer is a chunk of memory set aside so you can preprocess data for use somewhere else. A common example is a screen buffer in graphics rendering. You process all the graphics in the screen buffer first so you can throw it all onto the screen at once, instead of rendering each graphic to the screen one at a time, which tends to cause choppiness or flicker.

Share this post


Link to post
Share on other sites
sheesh, be a little more kind here. This is what boards are for.

A buffer is simply a region of memory. There are many types of buffers: video buffers, sound buffers, etc.

char buffer[80];

that could be called a buffer, used to store stuff. a video buffer would look like this:

unsigned char video_buffer[640*480*32] where the size of the buffer, is, obviously 640*480*32 (640x480x32 bits).

You''ll get a "feel" for them after doing some DirectDraw stuff (yes, ancient, I know).

Share this post


Link to post
Share on other sites
quote:
Original post by Cipher3D
[...]unsigned char video_buffer[640*480*32] where the size of the buffer, is, obviously 640*480*32 (640x480x32 bits).[...]
Actually, that would be 640*480*256 bits. You''d need 640*480*4 for the 32bit version.

Share this post


Link to post
Share on other sites
A buffer in game context is usually used for creating or caching something before it''s displayed / used.

In input systems, input is generally read into a buffer (as capturing each even live isn''t generally that useful and could cause lost events).

In graphics, you''ll see terminology such as "frame buffer", this is where the new image for the screen is calculated before it''s displayed; this helps create a smoother and less glitchy display.

In general, buffers are used to store data or stablise a stream of data.

Share this post


Link to post
Share on other sites

  • Advertisement