glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GL_COLOR_BUFFER_BIT and GL_DEPTH_BUFFER_BIT aren"t functions, they"re constants. You use them to tell glClear() which buffers you want it to clear - in her example, the depth buffer and also the "buffers currently allowed for shade writing". Friend can likewise pass GL_ACCUM_BUFFER_BIT to clean the build-up buffer and/or GL_STENCIL_BUFFER_BIT to clean the stencil buffer.
You are watching: Gl_color_buffer_bit
The actual values of the constants shouldn"t issue to you when using the library - the essential implementation detail is that the binary representations for each continuous don"t overlap with each other. It"s the characteristic that allows you pass the bitwise OR of lot of constants come a solitary call to glClear().
Check out the glClear() documention for much more details.
A contact to glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) clears the OpenGL color and depth buffers (or any other buffer or mix of buffers). OpenGL being a state machine, the is great practice to begin each framework with a clean slate.
I stumble top top this question while reading about this and thought to add some details for anyone confused. I view these two variables are continuous represent alternatives in bit values.
The glClear() an approach needs to recognize what form of buffer to clear. However, there are countless buffers such together color and also depth buffers and also others (https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glClear.xml).
By making use of bits come represent options it become easier to collection multiple alternatives by performing an OR operation.
For more details check out this "Bit Manipulation" tutorial, specific "When are bit flags many useful?" ar at : https://www.learncpp.com/cpp-tutorial/bit-manipulation-with-bitwise-operators-and-bit-masks/
Thanks because that contributing an answer to ridge Overflow!Please be sure to answer the question. Provide details and share your research!
But avoid …Asking because that help, clarification, or responding to other answers.Making statements based upon opinion; earlier them up with references or an individual experience.
See more: Best 30 Used Car Dealerships With Buy Here Pay Here Morganton Nc 28655
To learn more, check out our tips on writing good answers.
short article Your price Discard
Not the answer you're spring for? Browse other questions tagged opengl or ask your own question.
site architecture / logo © 2021 ridge Exchange Inc; user contributions licensed under cc by-sa. Rev2021.9.16.40232