GLUTSWAPBUFFERS(3)

πŸ“¦
version 3.8.0 Β· 2 versions
, in centos-stream 10, centos-stream 9, fedora 43, fedora 44, opensuse-leap 16.0

✨ GLUTSWAPBUFFERS(3) ✨

okay so bestie, welcome to the OpenGLUT window manual πŸ’– this one's about glutSwapBuffers β€” the iconic lil function that swaps the buffers for the current window. it lives in the OpenGLUT - window section, and honestly? she's the moment. no cap. 🫢


🌸 SYNOPSIS 🌸

#include <openglut.h>

void
glutSwapBuffers(void);

like yes, that's the whole vibe. one function, no args, no drama. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this function is you signalling to OpenGLUT that you're done drawing to the current window β€” for now, bestie, just for now. πŸŽ€

and then here's the slay: if your window is double-buffered (that's the GLUT_DOUBLE param you'd pass to glutInitDisplayMode()), OpenGLUT will swap the front buffer with the back buffer. front goes back, back goes front, it's giving choreography. ✨

this also computes your current frame-rate and prints the result on stderr if it's indicated by the GLUT_FPS environment variable. πŸ“

heads up though β€” that computed value is not necessarily the total frame rate, if you have multiple windows, because the statistic is the total number of buffer-swaps for the entire program. so like, it's a group project stat, not a solo stat. 😭

πŸ’€ CAVEATS πŸ’€

  • this function has no effect if your window is GLUT_SINGLE. literally nothing happens. it's giving ghosted. πŸ™ˆ
  • frame rate is only calculated for double-buffered windows.

🧚 TODO 🧚

  • how does this interact with overlays? genuinely asking, the mystery remains. πŸ‘€
  • consider making GLUT_FPS keep per-window stats in a multi-window program. (the group chat has been asking for this fr fr.)

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the page, bestie!! this one's stamped UNDATED and the source/version line is just... UNTITLED() 😭 which is honestly the most mysterious main character energy imaginable β€” no date, no title, just vibes. go swap some buffers, you got this. πŸ’–βœ¨πŸŽ€πŸ¦‹