Vertical bar in arguments

Oct 28, 2012 at 6:38pm
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)
Oct 28, 2012 at 6:47pm
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.
Oct 28, 2012 at 6:50pm
Last edited on Oct 28, 2012 at 6:53pm
Topic archived. No new replies allowed.