Getting Back Buffer Pointer in SDL - General and Gameplay Programming
Getting Back Buffer Pointer in SDL - 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
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
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.
Flatlander 170
March 09, 2006 09:58 AM
"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
^^ 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.