0% found this document useful (0 votes)
17 views

Getting Back Buffer Pointer in SDL - General and Gameplay Programming

The document discusses getting a pointer to the back buffer in SDL for rendering frames efficiently in an isometric game engine. It explores using an offscreen surface or checking if SDL_GetVideoSurface returns the current back buffer, but doesn't find a definitive solution. The poster still wants pointers to the current and last frames to offset rendering and reduce blits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Getting Back Buffer Pointer in SDL - General and Gameplay Programming

The document discusses getting a pointer to the back buffer in SDL for rendering frames efficiently in an isometric game engine. It explores using an offscreen surface or checking if SDL_GetVideoSurface returns the current back buffer, but doesn't find a definitive solution. The poster still wants pointers to the current and last frames to offset rendering and reduce blits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

 Back to General and Gameplay Programming

 Home
Popular Topics
 Blogs How do you manage yourself and
 Getting back buffer pointer in SDL? your time as years pass on?
General and Gameplay Programming Programming GDNet Lounge
 Forums
Started by NovaCaine March 08, 2006 05:28 PM
3 comments, last by NovaCaine 18 years, 1 month ago  How can i NOT get lost and
 News completely lose interest in the
infinite sea of game development?
 Portfolios For Beginners

NovaCaine  158 Author Do your part to stop global


 Projects
March 08, 2006 05:28 PM warming and climate change
GDNet Lounge
 Tutorials Hey all, I'm currently coding my own Isometric engine, following the
basic theory from the book "Isometric game programming with DirectX
The promise of freedom in story
7.0" but using SDL as the GFX API instead (for portability). I'm now to
25 users logged in games
the point where I need to cut down the amount of bilts I do every frame
Game Design and Theory
( I'm not using OpenGL, only SDL ) as I am currently rendering
New? Learn about game
development. everything every frame, and to follow the same techniques as Integer overflow issue in script
mentioned in the book, I need to get a pointer to the back buffer but
AngelCode
Before posting, review can't seem to find a way to do so with SDL. One thought I had was to
our community
guidelines. blit the screen to and offscreen surface and use that as my back Team Culture and experiences with
buffer, but that would take up more memory and an extra blit. Is there working in a team as a game
Follow Us any other way anyone can think of? Thanks in advance for any help. developer
   Games Career Development

Chat in the GameDev.net
Discord!
Mastodon

JohnnyCasil  373
Recommended Tutorials
March 08, 2006 08:25 PM
Fighting Game Design with Dan
If my understanding of SDL is as good as I like to think it is (Its Fornace: The Power of Silhouettes
probably not), if you have SDL_DOUBLEBUF declared as a flag when Game Design and Theory
you SDL_SetVideoMode, when you call SDL_GetVideoSurface, the
surface returned is the current back buffer. If I am wrong, someone Fundamentals of Horror
please correct me. Game Design and Theory

 Game Unified Process


General and Gameplay Programming

3 Steps to Mastering Your Game's


Anonymous  Soft Launch
March 08, 2006 09:15 PM Production and Management

Maybe, that does make some sense - but the problem is I want to Conducting a Project Postmortem
reference it for the next time I render. So if it's a pointer to te back Business and Law
buffer, then I need a pointer to the front buffer.

So far my searching seems to re-enforce the extra blit approach, which


isn't that bad really - I'd just prefer not to do it if I dont have to.

Flatlander  170
March 09, 2006 09:58 AM

Maybe this would help:


http://www.linuxdevcenter.com/pub/a/linux/2003/08/07/sdl_anim.ht
ml ?

"Copying and swapping both get the next frame on the screen. You
only care about the difference if you are doing incremental updates of
the frames. If SDL_Flip() is copying buffers, the back buffer always has
a copy of the last frame that was drawn. If SDL_Flip() is doing page
swapping, the back buffer usually contains the next-to-last frame. I say
usually because double buffering can be implemented using a hidden
third buffer to reduce the time spent waiting for the buffer swap to
happen. You can find out what kind of swapping is being done by
watching the value of the back buffer pointer (screen->pixels in
hardware.cpp) to see if it changes and how many different values it
has. If it never changes, then SDL_Flip() is copying the pixels. If it
toggles back and forth between two values, then page swapping is
being used."


---from www.yellow-hut.com/blog

NovaCaine  158 Author


March 09, 2006 06:02 PM

^^ Thanks for that - very interesting read, but it still doesn't answer my
question.

What I'm wanting is to have to pointers - one for the current frame
(frame to render) and the last frame. This is so I can offset the
previous image to save on blits.

It also appears that I can't get a hardware surface in windowed mode,


only when I go fullscreen.

This topic is closed to new replies.

You might also like