Vertical bar in arguments

In many OpenGL functions, it allows you to specify multiple options for a single parameter. How would I go about doing this in regular C++?

Ex:

 
QGLFormat(QGL::SampleBuffer | QGL::DepthBuffer)
Exactly the same way. That's standard C++. It's the bitwise OR operator.

QGL::SampleBuffer will have a single bit set to one, and all the rest zero. Likewise QGL::DepthBuffer. When you bitwise OR them, you get a new number with both those bits set to one, and all the rest zero. Each bit represents something being turned on or off.
Last edited on
Topic archived. No new replies allowed.